forked from KolibriOS/kolibrios
Appearance and Pixie fixes, upload TTF Viewer v0.1
git-svn-id: svn://kolibrios.org@5548 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2d64a2d4dd
commit
85f85fa6d0
@ -79,10 +79,12 @@ void Draw_List()
|
||||
{
|
||||
int i;
|
||||
int yyy;
|
||||
int list_last;
|
||||
list[SKINS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20);
|
||||
list[WALLPAPERS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20);
|
||||
|
||||
for (i=0; i<list[active].visible; i++;)
|
||||
if (list[active].count > list[active].visible) list_last = list[active].visible; else list_last = list[active].count;
|
||||
|
||||
for (i=0; i<list_last; i++;)
|
||||
{
|
||||
cur = list[active].first;
|
||||
strcpy(#temp_filename, files_mas[i+cur]*304 + buf+72);
|
||||
@ -94,12 +96,12 @@ void Draw_List()
|
||||
if (sc.work_button<>sc.work)
|
||||
{
|
||||
DrawBar(0, yyy, list[active].w, list[active].line_h, sc.work_button);
|
||||
WriteText(12,yyy+list[active].text_y,0x80,sc.work_button_text, #temp_filename);
|
||||
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,sc.work_button_text, #temp_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawBar(0, yyy, list[active].w, list[active].line_h, sc.grab_button);
|
||||
WriteText(12,yyy+list[active].text_y,0x80,sc.grab_button_text, #temp_filename);
|
||||
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,sc.grab_button_text, #temp_filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -108,7 +110,7 @@ void Draw_List()
|
||||
WriteText(12,yyy+list[active].text_y,0x80,0, #temp_filename);
|
||||
}
|
||||
}
|
||||
DrawBar(0,list[active].visible*list[active].line_h+list[active].y, list[active].w, -list[active].visible*list[active].line_h+ list[active].h, 0xFFFfff);
|
||||
DrawBar(0,list_last*list[active].line_h+list[active].y, list[active].w, -list_last*list[active].line_h+ list[active].h, 0xFFFfff);
|
||||
DrawScroller();
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
@echo #define LANG_ENG 1 >lang.h--
|
||||
|
||||
C-- appearance.c
|
||||
@del appearance.kex
|
||||
@rename appearance.com appearance.kex
|
||||
@del appearance
|
||||
@rename appearance.com appearance
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
@ -2,8 +2,8 @@
|
||||
@echo #define LANG_RUS 1 >lang.h--
|
||||
|
||||
C-- appearance.c
|
||||
@del appearance.kex
|
||||
@rename appearance.com appearance.kex
|
||||
@del appearance
|
||||
@rename appearance.com appearance
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
@ -1,5 +1,10 @@
|
||||
C-- example.c
|
||||
@del example
|
||||
@rename example.com example
|
||||
@pause
|
||||
kpack example
|
||||
@del warning.txt
|
||||
@pause
|
||||
@rem ====== Automatically add binnary to kolibri.img and then run QEMU =====
|
||||
@rem"C:\Program Files (x86)\WinImage\WINIMAGE.exe" D:\Kolibri\work\QEMU\kolibri.img /I /H/Q C:\Users\Leency\Dropbox\CMM\example\example
|
||||
@rem @cd /d C:\Work\QEMU
|
||||
@rem C:\Work\QEMU\kolibri_qumu.bat
|
@ -5,6 +5,8 @@
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\copyf.h"
|
||||
|
||||
#include "..\lib\patterns\restart_process.h"
|
||||
|
||||
#include "add_appl_dir.c";
|
||||
|
||||
?define T_END "\'“áâ ®¢ª KolibriN ãá¯¥è® § ¢¥àè¥ .\' -O"
|
||||
@ -15,13 +17,15 @@ void main()
|
||||
mem_Init();
|
||||
SetAddApplDir("kolibrios", abspath("kolibrios")+1);
|
||||
RunProgram("/sys/media/kiv", "\\S__/kolibrios/res/Wallpapers/In the wind there is longing.png");
|
||||
notify(T_END);
|
||||
copyf(abspath("tmp"), "/tmp0/1");
|
||||
copyf(abspath("sys"), "/sys");
|
||||
RestartProcessByName("@icon", MULTIPLE);
|
||||
RestartProcessByName("@taskbar", SINGLE);
|
||||
RestartProcessByName("@docky", SINGLE);
|
||||
notify(T_END);
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
|
||||
void copyf_Draw_Progress(dword filename) { return; }
|
||||
|
||||
|
||||
|
@ -588,4 +588,11 @@ inline fastcall void DeleteButton( EDX)
|
||||
EAX = 8;
|
||||
EDX += BT_DEL;
|
||||
$int 0x40;
|
||||
}
|
||||
|
||||
inline fastcall dword GetStartTime()
|
||||
{
|
||||
$mov eax,26
|
||||
$mov ebx,9
|
||||
$int 0x40
|
||||
}
|
19
programs/cmm/lib/patterns/restart_process.h
Normal file
19
programs/cmm/lib/patterns/restart_process.h
Normal file
@ -0,0 +1,19 @@
|
||||
enum {
|
||||
MULTIPLE,
|
||||
SINGLE
|
||||
};
|
||||
|
||||
void RestartProcessByName(dword proc_name, byte multiple) {
|
||||
int i;
|
||||
proc_info Process;
|
||||
for (i=0; i<1000; i++;)
|
||||
{
|
||||
GetProcessInfo(#Process, i);
|
||||
if (strcmpi(#Process.name, proc_name)==0)
|
||||
{
|
||||
KillProcess(Process.ID);
|
||||
if (multiple==SINGLE) break;
|
||||
}
|
||||
}
|
||||
RunProgram(proc_name, "");
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
#include "..\lib\obj\box_lib.h"
|
||||
|
||||
#include "..\lib\patterns\libimg_load_skin.h"
|
||||
#include "..\lib\patterns\restart_process.h"
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define WINDOW_TITLE "<EFBFBD> áâனª¨ ¯ ¥«¨ § ¤ ç ¨ „®ª "
|
||||
@ -246,20 +247,17 @@ void SaveCfg(byte panel_type)
|
||||
|
||||
void RestartProcess(byte panel_type)
|
||||
{
|
||||
int i;
|
||||
dword proc_name;
|
||||
proc_info Process;
|
||||
if (panel_type == TASKBAR) proc_name = "@taskbar";
|
||||
if (panel_type == DOCKY) proc_name = "@docky";
|
||||
for (i=0; i<1000; i++;)
|
||||
dword proc_name1;
|
||||
if (panel_type == TASKBAR)
|
||||
{
|
||||
GetProcessInfo(#Process, i);
|
||||
if (strcmpi(#Process.name, proc_name)==0) { KillProcess(Process.ID); break; }
|
||||
RestartProcessByName("@taskbar", SINGLE);
|
||||
pause(50);
|
||||
}
|
||||
else
|
||||
{
|
||||
RestartProcessByName("@docky", SINGLE);
|
||||
pause(120);
|
||||
}
|
||||
RunProgram(proc_name, "");
|
||||
|
||||
if (panel_type == TASKBAR) pause(50);
|
||||
if (panel_type == DOCKY) pause(120);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
ActivateWindow(GetProcessSlot(Form.ID));
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
char temp_filename[4096],
|
||||
work_folder[4096],
|
||||
current_filename[256];
|
||||
int files_mas[2000];
|
||||
dword buf;
|
||||
|
||||
@ -8,10 +5,11 @@ dword buf;
|
||||
void OpenDirectory(dword folder_path)
|
||||
{
|
||||
int cur;
|
||||
char temp_filename[4096];
|
||||
dword j, filesnum, end_pointer;
|
||||
|
||||
list.count = 0;
|
||||
//free(buf);
|
||||
if (buf) free(buf);
|
||||
if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0)
|
||||
if (filesnum==0)
|
||||
{
|
||||
@ -28,7 +26,6 @@ void OpenDirectory(dword folder_path)
|
||||
list.count++;
|
||||
}
|
||||
SortByName(0, list.count-1);
|
||||
SetOpenedFileFirst();
|
||||
}
|
||||
|
||||
void SortByName(int a, b)
|
||||
@ -41,10 +38,10 @@ void SortByName(int a, b)
|
||||
SortByName(i, b);
|
||||
}
|
||||
|
||||
void SetOpenedFileFirst()
|
||||
void SetOpenedFileFirst(dword in_name)
|
||||
{
|
||||
int i;
|
||||
dword opened_filename = #param + strrchr(#param, '/');
|
||||
dword opened_filename = in_name + strrchr(in_name, '/');
|
||||
for (i=0; i<list.count; i++)
|
||||
{
|
||||
if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
|
||||
|
@ -62,6 +62,9 @@ enum {
|
||||
THEME_LIGHT
|
||||
};
|
||||
|
||||
char work_folder[4096],
|
||||
current_filename[256];
|
||||
|
||||
|
||||
#include "get_files_list.h"
|
||||
#include "settings.h"
|
||||
@ -89,7 +92,11 @@ void main()
|
||||
strcpy(#work_folder, #param);
|
||||
work_folder[strrchr(#work_folder, '/')-1]='\0';
|
||||
}
|
||||
if (work_folder) OpenDirectory(#work_folder);
|
||||
if (work_folder)
|
||||
{
|
||||
OpenDirectory(#work_folder);
|
||||
SetOpenedFileFirst(#param);
|
||||
}
|
||||
|
||||
StartPlayingMp3();
|
||||
list.SetSizes(1, skin.h, skin.w-1, 198, 40, 18);
|
||||
@ -143,7 +150,7 @@ void main()
|
||||
} while (drag_mouse.lkm);
|
||||
}
|
||||
if (m.pkm) && (m.y > skin.h)
|
||||
notify("'Pixies Player v1.1\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n");
|
||||
notify("'Pixies Player v1.11\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n");
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
@ -232,7 +239,7 @@ void main()
|
||||
if (current_playing_file_n < list.count)
|
||||
{
|
||||
current_playing_file_n = list.current;
|
||||
StartPlayingMp3();
|
||||
if (list.KeyDown()) StartPlayingMp3();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -249,6 +256,7 @@ void DrawPlayList()
|
||||
{
|
||||
int i;
|
||||
int yyy;
|
||||
char temp_filename[4096];
|
||||
|
||||
for (i=0; i<list.visible; i++;)
|
||||
{
|
||||
|
11
programs/cmm/ttf_viewer/compile_en.bat
Normal file
11
programs/cmm/ttf_viewer/compile_en.bat
Normal file
@ -0,0 +1,11 @@
|
||||
@del lang.h--
|
||||
@echo #define LANG_ENG 1 >lang.h--
|
||||
|
||||
@del ttf_viewer
|
||||
cls
|
||||
c-- ttf_viewer.c
|
||||
@rename ttf_viewer.com ttf_viewer
|
||||
@kpack ttf_viewer
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
11
programs/cmm/ttf_viewer/compile_ru.bat
Normal file
11
programs/cmm/ttf_viewer/compile_ru.bat
Normal file
@ -0,0 +1,11 @@
|
||||
@del lang.h--
|
||||
@echo #define LANG_RUS 1 >lang.h--
|
||||
|
||||
@del ttf_viewer
|
||||
cls
|
||||
c-- ttf_viewer.c
|
||||
@rename ttf_viewer.com ttf_viewer
|
||||
@kpack ttf_viewer
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
14
programs/cmm/ttf_viewer/simple_open_dialog.h
Normal file
14
programs/cmm/ttf_viewer/simple_open_dialog.h
Normal file
@ -0,0 +1,14 @@
|
||||
struct od_filter
|
||||
{
|
||||
dword size;
|
||||
byte end;
|
||||
};
|
||||
|
||||
proc_info pr_inf;
|
||||
char communication_area_name[] = "FFFFFFFF_open_dialog";
|
||||
byte plugin_path[4096];
|
||||
char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial
|
||||
byte openfile_path[2048];
|
||||
byte filename_area[4096];
|
||||
|
||||
opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120};
|
115
programs/cmm/ttf_viewer/ttf_viewer.c
Normal file
115
programs/cmm/ttf_viewer/ttf_viewer.c
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef AUTOBUILD
|
||||
#include "lang.h--"
|
||||
#endif
|
||||
|
||||
#define MEMSIZE 397113
|
||||
#include "..\lib\kolibri.h"
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\dll.h"
|
||||
#include "..\lib\gui.h"
|
||||
#include "..\lib\obj\truetype.h"
|
||||
#include "..\lib\obj\proc_lib.h"
|
||||
|
||||
#include "simple_open_dialog.h"
|
||||
char default_dir[] = "/rd/1";
|
||||
od_filter filter2 = {"TTF",0};
|
||||
|
||||
dword font_data;
|
||||
stbtt_fontinfo font_info;
|
||||
dword font_mem;
|
||||
|
||||
system_colors sc;
|
||||
proc_info Form;
|
||||
char test_text[] = "The quick brown fox jumps over the lazy dog";
|
||||
char win_title[4096] = "TTF Viewer v0.1 - ";
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define T_INTRO "<EFBFBD>â® ¯à®áâ ï ¯à®£à ¬¬ ¤«ï ¯à®á¬®âà èà¨ä⮢ ä®à¬ â TTF"
|
||||
?define T_INTRO_BUTTON_TEXT "Žâªàëâì èà¨äâ"
|
||||
#else
|
||||
?define T_INTRO "This is simple program to view TTF fonts."
|
||||
?define T_INTRO_BUTTON_TEXT "Open font"
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
int id, key;
|
||||
|
||||
mem_Init();
|
||||
if (load_dll2(libtruetype, #truetype, 1) != 0) notify("Error: library doesn't exists - truetype");
|
||||
if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify("Error: library doesn't exists - Proc_lib (open_dialog)");
|
||||
OpenDialog_init stdcall (#o_dialog);
|
||||
|
||||
if (param[0]) OpenFont(#param);
|
||||
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
if (id==10)
|
||||
{
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
OpenFont(#openfile_path);
|
||||
}
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
draw_window();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
sc.get();
|
||||
DefineAndDrawWindow(30, 100, 800, 250+GetSkinHeight(), 0x34, 0xFFFfff, #win_title);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
DrawFonts();
|
||||
}
|
||||
|
||||
|
||||
word DrawFonts()
|
||||
{
|
||||
if (!font_data)
|
||||
{
|
||||
WriteTextCenter(0,85,Form.cwidth,0x555555, T_INTRO);
|
||||
DrawCaptButton(Form.cwidth - 140 / 2, Form.cheight - 30 / 2, 140, 30, 10, sc.work_button, sc.work_button_text, T_INTRO_BUTTON_TEXT);
|
||||
return;
|
||||
}
|
||||
text_out stdcall (#test_text, #font_info, 10, 0x000000, 0xFFFfff, 3, 4);
|
||||
text_out stdcall (#test_text, #font_info, 12, 0x000000, 0xFFFfff, 3, 18);
|
||||
text_out stdcall (#test_text, #font_info, 24, 0x000000, 0xFFFfff, 3, 35);
|
||||
text_out stdcall (#test_text, #font_info, 36, 0x000000, 0xFFFfff, 3, 60);
|
||||
text_out stdcall (#test_text, #font_info, 48, 0x000000, 0xFFFfff, 3, 110);
|
||||
text_out stdcall (#test_text, #font_info, 58, 0x000000, 0xFFFfff, 3, 170);
|
||||
}
|
||||
|
||||
|
||||
void OpenFont(dword font_path)
|
||||
{
|
||||
BDVK FontFile_atr;
|
||||
GetFileInfo(font_path, #FontFile_atr);
|
||||
font_data = malloc(FontFile_atr.sizelo);
|
||||
ReadFile(0, FontFile_atr.sizelo, #font_data, font_path);
|
||||
init_font stdcall (#font_info, #font_data);
|
||||
if (EAX==0)
|
||||
{
|
||||
font_data = 0;
|
||||
notify("'Can\096t open font: init_font failed' - E");
|
||||
}
|
||||
strcpy(#win_title + 18, font_path);
|
||||
draw_window();
|
||||
}
|
||||
|
||||
stop:
|
Loading…
Reference in New Issue
Block a user