forked from KolibriOS/kolibrios
TinyHashView 2.5:
- Added launch of OpenDialog if the program is launched without parameters. - Macros are used for convenient work with the clipboard git-svn-id: svn://kolibrios.org@8430 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
#SHS
|
||||
/kolibrios/develop/tcc/tcc thashview.c -o thashview -lck -lcryptal
|
||||
/kolibrios/develop/tcc/tcc thashview.c -o thashview -lck -lcryptal -ldialog
|
||||
|
@@ -7,7 +7,7 @@ KPACK=kpack
|
||||
|
||||
SRC=thashview.c
|
||||
CFLAGS=-I $(KTCC_DIR)/libc/include
|
||||
LIBS = -lck -lcryptal
|
||||
LIBS = -lck -lcryptal -ldialog
|
||||
|
||||
all:
|
||||
$(KTCC) $(CFLAGS) $(SRC) $(LIBS) -o $(NAME)
|
||||
|
@@ -1,5 +1,7 @@
|
||||
/*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ᨬ(turbocat2001) */
|
||||
/* Copyright (C) 2019-2020 Logaev Maxim (turbocat2001), GPLv3 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <kos32sys1.h>
|
||||
#include <string.h>
|
||||
@@ -7,14 +9,14 @@
|
||||
#include <cryptal/md5.h>
|
||||
#include <cryptal/sha1.h>
|
||||
#include <cryptal/sha256.h>
|
||||
#include <clayer/dialog.h>
|
||||
|
||||
#define TRUE 1;
|
||||
#define FALSE 0;
|
||||
#define MAX_HASH_LEN 65 // <20><><EFBFBD>ᨬ<EFBFBD><E1A8AC>쭠<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>ப<EFBFBD>
|
||||
#define WINDOW_W 665
|
||||
#define VERSION "%s - thashview 2.4"
|
||||
#define VERSION "%s - thashview 2.5"
|
||||
|
||||
typedef unsigned char bool;
|
||||
struct kolibri_system_colors sys_color_table;
|
||||
|
||||
char hex[]={"abcdefABCDEF1234567890"}; //<2F><><EFBFBD> <20><EFBFBD>ન <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -34,7 +36,6 @@ enum MYCOLORS //
|
||||
GREY = 0x00DDD7CF
|
||||
};
|
||||
|
||||
|
||||
unsigned int str_pos=0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>ப<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
int md5_flag=0, sha1_flag=0, sha256_flag=0; // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>뢠<EFBFBD>騥 <20>뫠 <20><> 㦥 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⠭<EFBFBD> <20><><EFBFBD>쭠<E0AEAB> <20>㬬<EFBFBD> <20> <20>㭪樨 check_sum()
|
||||
int edit_box_text_color=BLACK; // <20><><EFBFBD><EFBFBD>砫<EFBFBD><E7A0AB><EFBFBD><EFBFBD> 梥<> ⥪<><E2A5AA><EFBFBD> <20> <20><>ப<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -168,8 +169,8 @@ void sprint_hash(BYTE *hash, char* hash_str, int hash_size) //
|
||||
|
||||
void redraw_window() //<2F><><EFBFBD>㥬 <20><><EFBFBD><EFBFBD>
|
||||
{
|
||||
pos_t win_pos = get_mouse_pos(0); //<2F><><EFBFBD><EFBFBD>砥<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
sprintf(title,VERSION, filename); // <20><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
pos_t win_pos = get_mouse_pos(0); // <20><><EFBFBD><EFBFBD>砥<EFBFBD> <20><><EFBFBD>न<EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
begin_draw(); //<2F><>稭<EFBFBD><E7A8AD><EFBFBD> <20><>ᮢ<EFBFBD><E1AEA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>䥩<EFBFBD><E4A5A9> )
|
||||
sys_create_window(win_pos.x, win_pos.y, WINDOW_W, 150, title, sys_color_table.work_area, 0x14); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
|
||||
@@ -213,14 +214,13 @@ void paste_to_edit_buffer() //
|
||||
{
|
||||
temp_buff=kol_clip_get(kol_clip_num()-1);
|
||||
memset(edit_box_buff,0,MAX_HASH_LEN);
|
||||
if(((int)*(temp_buff)>0) && ((int)*(temp_buff+4)==0) && ((int)*(temp_buff+8)==1))
|
||||
if(DATA(int, temp_buff,0)>0 && DATA(int,temp_buff,4)==TEXT && DATA(int,temp_buff,8)==CP866)
|
||||
{
|
||||
strncpy(edit_box_buff,temp_buff+12, MAX_HASH_LEN-1);
|
||||
str_pos=strlen(edit_box_buff);
|
||||
notify_show("'Pasted from clipboard!' -I");
|
||||
edit_box_text_color=BLACK;
|
||||
user_free(temp_buff);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,8 +232,8 @@ void copy_to_clipboard(char *text) //
|
||||
{
|
||||
char *temp_buffer=safe_malloc(MAX_HASH_LEN+12);
|
||||
memset(temp_buffer, 0, MAX_HASH_LEN);
|
||||
*(temp_buffer+4)=0;
|
||||
*(temp_buffer+8)=1;
|
||||
DATA(char,temp_buffer,4)=TEXT;
|
||||
DATA(char,temp_buffer,8)=CP866;
|
||||
strncpy(temp_buffer+12, text, MAX_HASH_LEN-1);
|
||||
kol_clip_set(strlen(text)+12, temp_buffer);
|
||||
notify_show("'Copied to clipboard!' -I");
|
||||
@@ -325,15 +325,29 @@ void edit_box(oskey_t key) //
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>砥<EFBFBD> <20><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
if(argc<2) // <20> <20><><EFBFBD>㬥<EFBFBD>⮢ <20><><EFBFBD> <20><> ᮮ<>頥<EFBFBD> <20><> <20>⮬
|
||||
if(argc<2) // <20> <EFBFBD><EFBFBD><EFBFBD>㬥<EFBFBD>⮢ <20><><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD>᪠<EFBFBD><E1AAA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>롮<EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
{
|
||||
kolibri_dialog_init(); // <20><><EFBFBD>樠<EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD>
|
||||
open_dialog* dialog = kolibri_new_open_dialog(OPEN,0, 0, 420, 320);
|
||||
OpenDialog_init(dialog);
|
||||
OpenDialog_start(dialog);
|
||||
if(dialog->status==SUCCESS) // <20> 䠩<> <20><><EFBFBD>࠭
|
||||
{
|
||||
global_var_init(strlen(dialog->openfile_path));
|
||||
strcpy(filename, dialog->openfile_path);
|
||||
}
|
||||
else // <20> 䠩<> <20><> <20><><EFBFBD>࠭
|
||||
{
|
||||
notify_show("'No file selected!' -E");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
free(dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
global_var_init(strlen(argv[1]));
|
||||
strcpy(filename, argv[1]);
|
||||
}
|
||||
|
||||
if(NULL==fopen(filename,"rb")) // <20> 䠩<><E4A0A9> <20><><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD>
|
||||
{
|
||||
@@ -346,11 +360,11 @@ int main(int argc, char** argv)
|
||||
notify_show("'Low screen resolution! Program will not display correctrly!' -W");
|
||||
}
|
||||
|
||||
int gui_event; // <20><>६<EFBFBD><E0A5AC><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> ᮡ<><E1AEA1><EFBFBD><EFBFBD>
|
||||
int gui_event; // <20><>६<EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> ᮡ<><E1AEA1><EFBFBD><EFBFBD>
|
||||
uint32_t pressed_button = 0; // <20><><EFBFBD> <20><><EFBFBD><EFBFBD>⮩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
get_system_colors(&sys_color_table);
|
||||
set_event_mask(0xC0000027); // <20><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᮡ<>⨩
|
||||
set_event_mask(0xC0000027);// <20><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᮡ<>⨩
|
||||
do // <20><><EFBFBD><EFBFBD> <20><>ࠡ<EFBFBD>⪨ ᮡ<>⨩
|
||||
{
|
||||
gui_event = get_os_event(); // <20><><EFBFBD><EFBFBD>砥<EFBFBD> ᮡ<>⨥
|
||||
@@ -427,4 +441,5 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
}while(1);
|
||||
exit(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user