/programs/bcc32/examples/open_dlg/Makefile |
---|
0,0 → 1,19 |
# Path to /programs |
SVN_PROGR:=../../.. |
# Path to /programs/bcc32 |
SVN_BCC32:=$(SVN_PROGR)/bcc32 |
# Path to t2fasm |
T2FASM:=$(SVN_BCC32)/t2fasm |
# Path to include |
INCLUDE:=$(SVN_BCC32)/include |
# Path to Bin folder |
KOS32_BCC:=/home/autobuild/borlandcpp/bin |
# Filename without .cpp |
FILENAME:=open_dlg |
include $(SVN_BCC32)/Makefile_app |
/programs/bcc32/examples/open_dlg/open_dlg.cpp |
---|
0,0 → 1,110 |
#include <kolibri.h> |
#include <kos_heap.h> |
#include <kos_file.h> |
#include <load_lib.h> |
#include <l_proc_lib.h> |
using namespace Kolibri; |
const char header[] = "Open Dialog"; |
char library_path[2048]; |
OpenDialog_data ofd; |
unsigned char procinfo[1024]; |
char plugin_path[4096], openfile_path[4096], filename_area[256]; |
od_filter filter1 = { 8, "TXT\0\0" }; |
namespace Kolibri{ |
char CurrentDirectoryPath[2048]; |
} |
void KolibriOnPaint(void); |
void __stdcall DrawWindow() |
{ |
asm{ |
push ebx |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
} |
KolibriOnPaint(); |
asm{ |
mcall SF_REDRAW,SSF_END_DRAW |
pop ebx |
} |
} |
bool KolibriOnStart(TStartData &kos_start, TThreadData /*th*/) |
{ |
kos_start.Left = 10; |
kos_start.Top = 40; |
kos_start.Width = 420; |
kos_start.Height = 320; |
kos_start.WinData.WindowColor = 0xFFFFFF; |
kos_start.WinData.WindowType = 0x33; // 0x34 - fixed, 0x33 - not fixed |
kos_start.WinData.Title = header; |
if(LoadLibrary("proc_lib.obj", library_path, "/sys/lib/proc_lib.obj", &import_proc_lib)) |
{ |
ofd.procinfo = procinfo; |
ofd.com_area_name = "FFFFFFFF_open_dialog"; |
ofd.com_area = 0; |
ofd.opendir_path = plugin_path; |
ofd.dir_default_path = "/rd/1"; |
ofd.start_path = "/rd/1/File managers/opendial"; |
ofd.draw_window = DrawWindow; |
ofd.status = 0; |
ofd.openfile_path = openfile_path; |
ofd.filename_area = filename_area; |
ofd.filter_area = &filter1; |
ofd.x_size = 420; |
ofd.x_start = 10; |
ofd.y_size = 320; |
ofd.y_start = 10; |
OpenDialog_Init(&ofd); |
} else return false; |
return true; |
} |
void KolibriOnPaint(void) |
{ |
// If button have ID 1, this is close button |
DrawButton(2,0xf0f0f0, 10,10,50,20); |
DrawText(20,16,0,"Open"); |
DrawButton(3,0xf0f0f0, 70,10,50,20); |
DrawText(80,16,0,"Save"); |
DrawButton(4,0xf0f0f0, 130,10,95,20); |
DrawText(140,16,0,"Select folder"); |
if(ofd.openfile_path[0]) DrawText(10,40,0,ofd.openfile_path); |
if(ofd.opendir_path[0]) DrawText(10,55,0,ofd.opendir_path); |
if(ofd.filename_area[0]) DrawText(10,70,0,ofd.filename_area); |
} |
void KolibriOnButton(long id, TThreadData /*th*/) |
{ |
FileInfoBlock* file; |
long int k; |
switch(id){ |
case 2: |
ofd.type = 0; // 0 - open |
OpenDialog_Start(&ofd); |
if(ofd.status==1){ |
//... open ... |
} |
break; |
case 3: |
ofd.type = 1; // 1 - save |
OpenDialog_Start(&ofd); |
if(ofd.status==1){ |
//... save ... |
} |
break; |
case 4: |
ofd.type = 2; // 2 - select folder |
OpenDialog_Start(&ofd); |
if(ofd.status==1){ |
//... |
} |
//break; |
}; |
} |
/programs/bcc32/examples/open_dlg/open_dlg_cpp.bat |
---|
0,0 → 1,15 |
Set NAME=open_dlg |
Set BCC_DIR=..\..\..\bcc32 |
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp |
echo STACKSIZE equ 8192> kos_make.inc |
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc |
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc |
echo include "kos_make.inc" > f_%NAME%.asm |
t2fasm < %NAME%.asm >> f_%NAME%.asm |
fasm f_%NAME%.asm %NAME%.kex |
if exist %NAME%.kex kpack %NAME%.kex |
if exist %NAME%.kex del kos_make.inc |
pause |
/programs/bcc32/include/kos_start.inc |
---|
4,7 → 4,7 |
dd 1 |
dd @Kolibri@Main$qv |
dd I_END |
dd U_END+STACKSIZE+HEAPSIZE |
dd U_END+STACKSIZE ;+HEAPSIZE |
dd U_END+STACKSIZE |
if defined @Kolibri@CommandLine |
dd @Kolibri@CommandLine |
/programs/bcc32/include/l_proc_lib.h |
---|
0,0 → 1,62 |
#ifndef __L_PROC_LIB_H_INCLUDED_ |
#define __L_PROC_LIB_H_INCLUDED_ |
// |
// proc_lib.obj |
// |
struct od_filter |
{ |
long size; //size = len(#ext) + sizeof(long) |
char ext[25]; |
}; |
struct OpenDialog_data{ |
long type; |
void* procinfo; // |
char* com_area_name; |
void* com_area; // |
char* opendir_path; |
char* dir_default_path; |
char* start_path; |
void (__stdcall* draw_window)(); |
long status; |
char* openfile_path; |
char* filename_area; |
od_filter* filter_area; |
short int x_size; // Window X size |
short int x_start; // Window X position |
short int y_size; // Window y size |
short int y_start; // Window Y position |
}; |
struct ColorDialog_data{ |
long type; |
void* procinfo; // |
char* com_area_name; |
void* com_area; // |
char* start_path; |
void (__stdcall* draw_window)(); |
long status; |
short int x_size; // Window X size |
short int x_start; // Window X position |
short int y_size; // Window y size |
short int y_start; // Window Y position |
long color_type; // 0- RGB, 1 or other - reserved |
long color; // Selected color |
}; |
// |
// proc_lib - import table |
// |
void (__stdcall* import_proc_lib)() = (void (__stdcall*)())&"lib_init"; |
void (__stdcall* OpenDialog_Init)(OpenDialog_data* odd) = (void (__stdcall*)(OpenDialog_data*))&"OpenDialog_init"; |
void (__stdcall* OpenDialog_Start)(OpenDialog_data* odd) = (void (__stdcall*)(OpenDialog_data*))&"OpenDialog_start"; |
void (__stdcall* OpenDialog_SetFileName)(OpenDialog_data* odd, char* name) = (void (__stdcall*)(OpenDialog_data*, char*))&"OpenDialog_set_file_name"; |
void (__stdcall* OpenDialog_SetFileExt)(OpenDialog_data* odd, char* ext) = (void (__stdcall*)(OpenDialog_data*, char*))&"OpenDialog_set_file_ext"; |
void (__stdcall* ColorDialog_Init)(ColorDialog_data* cdd) = (void (__stdcall*)(ColorDialog_data*))&"ColorDialog_init"; |
void (__stdcall* ColorDialog_Start)(ColorDialog_data* cdd) = (void (__stdcall*)(ColorDialog_data*))&"ColorDialog_start"; |
asm{ |
dd 0,0 |
} |
#endif |