Subversion Repositories Kolibri OS

Rev

Rev 8373 | Rev 8466 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8373 Rev 8430
Line 1... Line 1...
1
/*€¢â®à: ‹®£ ¥¢ Œ ªá¨¬(turbocat2001) */
1
/* Copyright (C) 2019-2020 Logaev Maxim (turbocat2001), GPLv3 */
-
 
2
 
2
#include 
3
#include 
-
 
4
#include 
3
#include 
5
#include 
4
#include 
6
#include 
5
#include 
7
#include 
6
#include 
8
#include 
7
#include 
9
#include 
8
#include 
10
#include 
9
#include 
11
#include 
-
 
12
#include 
Line 10... Line 13...
10
 
13
 
11
#define TRUE 1;
14
#define TRUE 1;
12
#define FALSE 0;
15
#define FALSE 0;
13
#define MAX_HASH_LEN 65 // Œ ªá¨¬ «ì­ ï ¤«¨­  áâப¨
16
#define MAX_HASH_LEN 65 // Œ ªá¨¬ «ì­ ï ¤«¨­  áâப¨
14
#define WINDOW_W 665
17
#define WINDOW_W 665
Line 15... Line -...
15
#define VERSION "%s - thashview 2.4"
-
 
16
 
18
#define VERSION "%s - thashview 2.5"
Line 17... Line 19...
17
typedef unsigned char bool;
19
 
18
struct kolibri_system_colors sys_color_table;
20
struct kolibri_system_colors sys_color_table;
19
 
21
 
Line 32... Line 34...
32
    BLACK = 0x00000000,
34
    BLACK = 0x00000000,
33
    WHITE = 0xFFFFFFFF,
35
    WHITE = 0xFFFFFFFF,
34
    GREY  = 0x00DDD7CF
36
    GREY  = 0x00DDD7CF
35
};
37
};
Line 36... Line -...
36
 
-
 
37
 
38
 
38
unsigned int str_pos=0; // ®§¨æ¨ï ªãàá®à  ¯à¨ ¯¥ç â¨ ¢ áâப¥ ¢¢®¤ 
39
unsigned int str_pos=0; // ®§¨æ¨ï ªãàá®à  ¯à¨ ¯¥ç â¨ ¢ áâப¥ ¢¢®¤ 
39
int md5_flag=0, sha1_flag=0, sha256_flag=0; // ”« £¨ ¯®ª §ë¢ î騥 ¡ë«  «¨ 㦥 à ááç¨â ­  ª®â஫쭠ï á㬬  ¢ ä㭪樨 check_sum()
40
int md5_flag=0, sha1_flag=0, sha256_flag=0; // ”« £¨ ¯®ª §ë¢ î騥 ¡ë«  «¨ 㦥 à ááç¨â ­  ª®â஫쭠ï á㬬  ¢ ä㭪樨 check_sum()
Line 40... Line 41...
40
int edit_box_text_color=BLACK; // ˆ§­ ç «ì­ë© 梥â ⥪áâ  ¢ áâப¥ ¢¢®¤ 
41
int edit_box_text_color=BLACK; // ˆ§­ ç «ì­ë© 梥â ⥪áâ  ¢ áâப¥ ¢¢®¤ 
Line 166... Line 167...
166
    free(hash);
167
    free(hash);
167
}
168
}
Line 168... Line 169...
168
 
169
 
169
void redraw_window() //¨á㥬 ®ª­®
170
void redraw_window() //¨á㥬 ®ª­®
170
{
-
 
171
    pos_t win_pos = get_mouse_pos(0); //®«ãç ¥¬ ¯®§¨æ¨î ªãàá®à  ¬ëè¨.
171
{
-
 
172
    sprintf(title,VERSION, filename); // “áâ ­ ¢«¨¢ ¥¬ § £®«®¢®ª ®ª­ 
172
    sprintf(title,VERSION, filename); // “áâ ­ ¢«¨¢ ¥¬ § £®«®¢®ª ®ª­ 
173
    pos_t win_pos = get_mouse_pos(0); // ®«ãç ¥¬ ª®®à¤¨­ âë ªãàá®à 
173
    begin_draw(); // ç¨­ ¥¬ à¨á®¢ ­¨¥ ¨­â¥àä¥©á  )
174
    begin_draw(); // ç¨­ ¥¬ à¨á®¢ ­¨¥ ¨­â¥àä¥©á  )
Line 174... Line 175...
174
    sys_create_window(win_pos.x, win_pos.y, WINDOW_W, 150, title, sys_color_table.work_area, 0x14); // ‘®§¤ ñ¬ ®ª­®.
175
    sys_create_window(win_pos.x, win_pos.y, WINDOW_W, 150, title, sys_color_table.work_area, 0x14); // ‘®§¤ ñ¬ ®ª­®.
175
 
176
 
Line 211... Line 212...
211
    char *temp_buff=NULL;
212
    char *temp_buff=NULL;
212
    if(kol_clip_num()>0)
213
    if(kol_clip_num()>0)
213
    {
214
    {
214
        temp_buff=kol_clip_get(kol_clip_num()-1);
215
        temp_buff=kol_clip_get(kol_clip_num()-1);
215
        memset(edit_box_buff,0,MAX_HASH_LEN);
216
        memset(edit_box_buff,0,MAX_HASH_LEN);
216
        if(((int)*(temp_buff)>0) && ((int)*(temp_buff+4)==0) && ((int)*(temp_buff+8)==1))
217
        if(DATA(int, temp_buff,0)>0 && DATA(int,temp_buff,4)==TEXT && DATA(int,temp_buff,8)==CP866)
217
        {
218
        {
218
            strncpy(edit_box_buff,temp_buff+12, MAX_HASH_LEN-1);
219
            strncpy(edit_box_buff,temp_buff+12, MAX_HASH_LEN-1);
219
            str_pos=strlen(edit_box_buff);
220
            str_pos=strlen(edit_box_buff);
220
            notify_show("'Pasted from clipboard!' -I");
221
            notify_show("'Pasted from clipboard!' -I");
221
            edit_box_text_color=BLACK;
222
            edit_box_text_color=BLACK;
222
            user_free(temp_buff);
223
            user_free(temp_buff);
223
        
-
 
224
        }
224
        }
225
    }
225
    }
226
}
226
}
Line 230... Line 230...
230
{
230
{
231
    if(55!=strlen(text))
231
    if(55!=strlen(text))
232
    {
232
    {
233
        char *temp_buffer=safe_malloc(MAX_HASH_LEN+12);
233
        char *temp_buffer=safe_malloc(MAX_HASH_LEN+12);
234
        memset(temp_buffer, 0, MAX_HASH_LEN);
234
        memset(temp_buffer, 0, MAX_HASH_LEN);
235
        *(temp_buffer+4)=0;
235
        DATA(char,temp_buffer,4)=TEXT;
236
        *(temp_buffer+8)=1;
236
        DATA(char,temp_buffer,8)=CP866;
237
        strncpy(temp_buffer+12, text, MAX_HASH_LEN-1);
237
        strncpy(temp_buffer+12, text, MAX_HASH_LEN-1);
238
        kol_clip_set(strlen(text)+12, temp_buffer);
238
        kol_clip_set(strlen(text)+12, temp_buffer);
239
        notify_show("'Copied to clipboard!' -I");
239
        notify_show("'Copied to clipboard!' -I");
240
        free(temp_buffer);
240
        free(temp_buffer);
241
    }
241
    }
Line 323... Line 323...
323
    }
323
    }
324
}
324
}
Line 325... Line 325...
325
 
325
 
326
int main(int argc, char** argv)
326
int main(int argc, char** argv)
-
 
327
{
-
 
328
    if(argc<2) // …᫨  à£ã¬¥­â®¢ ­¥â, â® § ¯ã᪠¥¬ ¤¨ «®£ ¢ë¡®à  ä ©« 
-
 
329
    {
-
 
330
        kolibri_dialog_init(); // ˆ­¨æ¨ «¨§ æ¨ï ¡¨¡«¨®â¥ª¨
-
 
331
        open_dialog* dialog = kolibri_new_open_dialog(OPEN,0, 0, 420, 320);
-
 
332
        OpenDialog_init(dialog);
327
{
333
        OpenDialog_start(dialog); 
-
 
334
        if(dialog->status==SUCCESS) // …᫨ ä ©« ¢ë¡à ­
-
 
335
        {
-
 
336
            global_var_init(strlen(dialog->openfile_path));
-
 
337
            strcpy(filename, dialog->openfile_path);  
328
    // ¯®«ãç ¥¬ ¨¬ï ä ©« 
338
        }
329
    if(argc<2) // …᫨  à£ã¬¥­â®¢ ­¥â â® á®®¡é ¥¬ ®¡ í⮬
339
        else // …᫨ ä ©« ­¥ ¢ë¡à ­
330
    {
340
        {
331
        notify_show("'No file selected!' -E");
341
            notify_show("'No file selected!' -E");
332
        exit(0);
342
            exit(0);
-
 
343
        }
-
 
344
        free(dialog);
-
 
345
    }
333
    }
346
    else
334
 
347
    {
335
    global_var_init(strlen(argv[1]));
348
        global_var_init(strlen(argv[1]));
-
 
349
        strcpy(filename, argv[1]);
Line 336... Line 350...
336
    strcpy(filename, argv[1]);
350
    }
337
 
351
 
338
    if(NULL==fopen(filename,"rb")) // …᫨ ä ©«  ­¥â ¨«¨ ­¥ ®âªà뢠¥âáï
352
    if(NULL==fopen(filename,"rb")) // …᫨ ä ©«  ­¥â ¨«¨ ­¥ ®âªà뢠¥âáï
339
    {
353
    {
Line 344... Line 358...
344
    if(GetScreenSize()/65536
358
    if(GetScreenSize()/65536
345
    {
359
    {
346
        notify_show("'Low screen resolution! Program will not display correctrly!' -W");
360
        notify_show("'Low screen resolution! Program will not display correctrly!' -W");
347
    }
361
    }
Line 348... Line 362...
348
 
362
 
349
    int gui_event; // ¥à¥¬­ ï ¤«ï åà ­¥­¨ï ᮡëâ¨ï
363
    int gui_event; // ¥à¥¬¥­­ ï ¤«ï åà ­¥­¨ï ᮡëâ¨ï
Line 350... Line 364...
350
    uint32_t pressed_button = 0; // Š®¤ ­ ¦ â®© ª­®¯ª¨ ¢ ®ª­¥
364
    uint32_t pressed_button = 0; // Š®¤ ­ ¦ â®© ª­®¯ª¨ ¢ ®ª­¥
351
 
365
 
352
    get_system_colors(&sys_color_table);
366
    get_system_colors(&sys_color_table);
Line 425... Line 439...
425
                    exit(0);
439
                    exit(0);
426
                break;
440
                break;
427
            }
441
            }
428
        }
442
        }
429
    }while(1);
443
    }while(1);
-
 
444
    exit(0);
430
}
445
}