Subversion Repositories Kolibri OS

Rev

Rev 6612 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6612 Rev 8581
Line 1... Line 1...
1
#ifndef KOLIBRI_FILEBROWSE_H
1
#ifndef KOLIBRI_FILEBROWSE_H
2
#define KOLIBRI_FILEBROWSE_H
2
#define KOLIBRI_FILEBROWSE_H
Line 3... Line 3...
3
 
3
 
4
struct  __attribute__ ((__packed__)) fs_dirinfo {
4
struct  __attribute__ ((__packed__)) fs_dirinfo {
5
    uint32_t    subfn; // 1 read dir
5
    uint32_t    subfn; // 1 read dir
6
    uint32_t    start;
6
    uint32_t    start;
Line 89... Line 89...
89
    struct fs_filedate dt_modified;
89
    struct fs_filedate dt_modified;
90
    uint64_t size;
90
    uint64_t size;
91
    wchar_t   fname[260];
91
    wchar_t   fname[260];
92
}; // must be sized 560
92
}; // must be sized 560
Line 93... Line 93...
93
 
93
 
94
 
94
 
95
typedef struct __attribute__ ((__packed__)) {
95
typedef struct __attribute__ ((__packed__)) {
96
	uint32_t type;  // unused
96
	uint32_t type;  // unused
97
	uint32_t x_w;  // 10, 400
97
	uint32_t x_w;  // 10, 400
98
	uint32_t y_h; // 45, 550
98
	uint32_t y_h; // 45, 550
99
	uint32_t icon_size_xy;  // x_y (16, 16)
99
	uint32_t icon_size_xy;  // x_y (16, 16)
100
	uint16_t line_size_x;  // not used
100
	uint16_t line_size_x;  // not used
101
	uint16_t line_size_y;  // 18 or 17  - âûñîòà ëèíèè - ñòðîêè ñ ôàéëîì
101
	uint16_t line_size_y;  // 18 or 17  - ������ ����� - ������ � ������
102
	uint16_t type_size_x;  // not used
102
	uint16_t type_size_x;  // not used
103
	uint16_t size_size_x;  // not used
103
	uint16_t size_size_x;  // not used
104
	uint16_t date_size_x;  // not used
104
	uint16_t date_size_x;  // not used
105
	uint16_t attributes_size_x; // not used
105
	uint16_t attributes_size_x; // not used
Line 108... Line 108...
108
	uint32_t icon_resolution_raw;  // ...
108
	uint32_t icon_resolution_raw;  // ...
109
	void* icon_palette_raw;      // ...
109
	void* icon_palette_raw;      // ...
110
	uint32_t directory_path_area;  // not used
110
	uint32_t directory_path_area;  // not used
111
	uint32_t file_name_area;  // not used
111
	uint32_t file_name_area;  // not used
112
	uint32_t select_flag;  // widget have focus, set auto on mouseclick, but need to reset before mouse()
112
	uint32_t select_flag;  // widget have focus, set auto on mouseclick, but need to reset before mouse()
113
	color_t background_color;  // self explained, 0xffffff
113
	color_t background_color;  // self explained, 0xffffff
114
	color_t select_color; // self explained, 0xbbddff
114
	color_t select_color; // self explained, 0xbbddff
115
    color_t select_text_color; // self explained - have a bug - never really used
115
    color_t select_text_color; // self explained - have a bug - never really used
116
    color_t text_color; // self explained
116
    color_t text_color; // self explained
117
    color_t reduct_text_color; // 0xff0000  - spec color for cutted filenames
117
    color_t reduct_text_color; // 0xff0000  - spec color for cutted filenames
118
    color_t marked_text_color; // not used
118
    color_t marked_text_color; // not used
119
    uint32_t max_panel_line;    // moved to scrollbar->cur_area, - ìàêñèìàëüíîå ÷èñëî ñòðîê â îêíå, àâòîðàñ÷èòûâàåòñÿ
119
    uint32_t max_panel_line;    // moved to scrollbar->cur_area, - ������������ ����� ����� � ����, �����������������
120
	uint32_t select_panel_counter;  // !=0 if want to draw multiselection ???
120
	uint32_t select_panel_counter;  // !=0 if want to draw multiselection ???
121
	uint32_t folder_block;   // auto formed, êîëè÷åñòâî áëîêîâ äàííûõ âõîäà êàòàëîãà (ÁÄÂÊ) ????? format BDVK == bdfe,, // moved to scrollbar->max_area
121
	uint32_t folder_block;   // auto formed, ���������� ������ ������ ����� �������� (����) ????? format BDVK == bdfe,, // moved to scrollbar->max_area
122
	uint32_t start_draw_line;    // internal - top showed file n. moved to scrollbar->position and back
122
	uint32_t start_draw_line;    // internal - top showed file n. moved to scrollbar->position and back
123
	uint16_t start_draw_cursor_line;  //internal
123
	uint16_t start_draw_cursor_line;  //internal
124
    void* folder_data;      // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
124
    void* folder_data;      // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
125
    uint32_t temp_counter; //internal
125
    uint32_t temp_counter; //internal
126
    uint32_t file_name_length; //internal
126
    uint32_t file_name_length; //internal
127
    uint32_t marked_file;  // have a mark 0/1 ?
127
    uint32_t marked_file;  // have a mark 0/1 ?
128
    uint32_t extension_size;  //internal
128
    uint32_t extension_size;  //internal
Line 148... Line 148...
148
    uint32_t display_name_max_length;  // autocounted
148
    uint32_t display_name_max_length;  // autocounted
149
    uint32_t draw_panel_selection_flag;  // flag internal showing selected item
149
    uint32_t draw_panel_selection_flag;  // flag internal showing selected item
150
    uint32_t mouse_pos_old;  // saved internal
150
    uint32_t mouse_pos_old;  // saved internal
151
    uint32_t marked_counter;  // number of marked files
151
    uint32_t marked_counter;  // number of marked files
152
    char* keymap_pointer;  // keyboard layout map
152
    char* keymap_pointer;  // keyboard layout map
153
 
153
 
154
} filebrowser;
154
} filebrowser;
Line 155... Line 155...
155
 
155
 
156
static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_res,
156
static inline filebrowser* kolibri_filebrowser(filebrowser* fb, uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_res,
157
                                         char* ini_file_start, char* ini_file_end,
157
                                         char* ini_file_start, char* ini_file_end,
158
                                         color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
158
                                         color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
159
{
159
{
160
    static char name_temp_area[256];
160
    static char name_temp_area[256];
161
    static char keymap_area[128];
161
    static char keymap_area[128];
Line 162... Line 162...
162
    static char type_table[128] = " 1023b 00.00.00 00:00     temp1.asm";
162
    static char type_table[128] = " 1023b 00.00.00 00:00     temp1.asm";
163
 
163
 
164
    memset(fb, 0, sizeof(filebrowser));
164
    memset(fb, 0, sizeof(filebrowser));
165
    fb->x_w = x_w;
165
    fb->x_w = x_w;
Line 166... Line 166...
166
    fb->y_h = y_h;
166
    fb->y_h = y_h;
167
    fb->font_size_xy = font_size_xy;
167
    fb->font_size_xy = font_size_xy;
168
 
168
 
169
    fb->icon_size_xy = icon_size_xy;
169
    fb->icon_size_xy = icon_size_xy;
Line 170... Line 170...
170
    fb->icon_raw_area = icon_raw_area;
170
    fb->icon_raw_area = icon_raw_area;
Line 171... Line 171...
171
    fb->icon_palette_raw = icon_palette_raw;
171
    fb->icon_palette_raw = icon_palette_raw;
172
    fb->icon_resolution_raw = icon_res;
172
    fb->icon_resolution_raw = icon_res;
173
 
173
 
174
    fb->line_size_y = (icon_size_xy & 0xFFFF) + 2;
174
    fb->line_size_y = (icon_size_xy & 0xFFFF) + 2;
175
 
175
 
176
    // constants
176
    // constants
Line 177... Line 177...
177
    fb->type_table = type_table;
177
    fb->type_table = type_table;
178
    fb->mouse_key_delay = 50;
178
    fb->mouse_key_delay = 50;
179
    fb->name_temp_area = name_temp_area;
179
    fb->name_temp_area = name_temp_area;
180
//    fb->max_name_temp_size = sizeof name_temp_area - 1;
180
//    fb->max_name_temp_size = sizeof name_temp_area - 1;
181
    fb->keymap_pointer = keymap_area;
181
    fb->keymap_pointer = keymap_area;
182
 
182
 
Line 183... Line 183...
183
    // careful - font sizes may be encoded in colors as SysFn4
183
    // careful - font sizes may be encoded in colors as SysFn4
184
    fb->background_color = bgcolor;  // self explained, 0xffffff
184
    fb->background_color = bgcolor;  // self explained, 0xffffff
185
	fb->select_color = bk_select; // self explained, 0xbbddff
185
	fb->select_color = bk_select; // self explained, 0xbbddff
186
    fb->select_text_color = font_select; // self explained
186
    fb->select_text_color = font_select; // self explained
187
    fb->text_color = font_color; // self explained
187
    fb->text_color = font_color; // self explained
188
    fb->reduct_text_color = reduct_color; // 0xff0000  - spec color for cutted filenames
188
    fb->reduct_text_color = reduct_color; // 0xff0000  - spec color for cutted filenames
189
 
189
 
190
    fb->ini_file_start = ini_file_start;
190
    fb->ini_file_start = ini_file_start;
191
    fb->ini_file_end = ini_file_end;
191
    fb->ini_file_end = ini_file_end;
192
/*
192
/*
193
    void* folder_data;      // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
193
    void* folder_data;      // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
194
*/
194
*/
195
    return fb;
195
    return fb;
196
}
196
}
197
 
197
 
198
static inline filebrowser* kolibri_new_filebrowser(uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_bpp,
198
static inline filebrowser* kolibri_new_filebrowser(uint32_t x_w, uint32_t y_h, uint32_t font_size_xy, uint32_t icon_size_xy, void* icon_raw_area, void* icon_palette_raw, uint32_t icon_bpp,
Line 199... Line 199...
199
                                         char* ini_file_start, char* ini_file_end,
199
                                         char* ini_file_start, char* ini_file_end,
200
                                         color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
200
                                         color_t font_select, color_t bk_select, color_t font_color, color_t bgcolor, color_t reduct_color)
201
{
201
{
Line 211... Line 211...
211
    char icons_ini[]       = "/rd/1/File managers/icons.ini";
211
    char icons_ini[]       = "/rd/1/File managers/icons.ini";
212
    char icons16img[]       = "/rd/1/File managers/z_icons.png";
212
    char icons16img[]       = "/rd/1/File managers/z_icons.png";
Line 213... Line 213...
213
 
213
 
214
    return kolibri_filebrowser(fb, x_w, y_h, X_Y(9, 16), X_Y(16, 16), icon_raw_area, icon_palette_raw, icon_res,
214
    return kolibri_filebrowser(fb, x_w, y_h, X_Y(9, 16), X_Y(16, 16), icon_raw_area, icon_palette_raw, icon_res,
215
                                         ini_file_start, ini_file_end,
215
                                         ini_file_start, ini_file_end,
216
                                         0x000000, 0xbbddff, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0xff0000);
216
                                         0x000000, 0xbbddff, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0xff0000);
217
}
217
}
Line 218... Line 218...
218
*/
218
*/
219
 
219
 
220
inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f)
220
static inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f)
221
{
221
{
Line 222... Line 222...
222
    kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f);
222
    kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f);
223
}
223
}
224
 
224
 
Line 225... Line 225...
225
extern void (*filebrowse_draw)(filebrowser *) __attribute__((__stdcall__));
225
extern void (*filebrowse_draw)(filebrowser *) __attribute__((__stdcall__));
226
extern void (*filebrowse_key)(filebrowser *) __attribute__((__stdcall__));
226
extern void (*filebrowse_key)(filebrowser *) __attribute__((__stdcall__));
227
extern void (*filebrowse_mouse)(filebrowser *) __attribute__((__stdcall__));
227
extern void (*filebrowse_mouse)(filebrowser *) __attribute__((__stdcall__));
228
 
228
 
Line 271... Line 271...
271
 
271
 
272
    if (extended_key) extended_key = 0;
272
    if (extended_key) extended_key = 0;
273
    (*filebrowse_key)(fb);
273
    (*filebrowse_key)(fb);
Line 274... Line 274...
274
}
274
}
275
 
275