unpack zips in src to better compression
This commit is contained in:
1115
sources/z-tools/trunk/zview/catalog/catalog.c
Normal file
1115
sources/z-tools/trunk/zview/catalog/catalog.c
Normal file
File diff suppressed because it is too large
Load Diff
19
sources/z-tools/trunk/zview/catalog/catalog.h
Normal file
19
sources/z-tools/trunk/zview/catalog/catalog.h
Normal file
@@ -0,0 +1,19 @@
|
||||
extern int WinCatalog( void);
|
||||
extern void WinCatalog_Close( WINDOW *win);
|
||||
extern void WinCatalog_Refresh( WINDOW *wind);
|
||||
extern void WindMakePreview( WINDOW *win);
|
||||
extern int WindMakePreview_needed( WINDOW *win);
|
||||
extern void WinCatalog_filelist_redraw( void);
|
||||
extern void WinCatalog_set_thumbnails_size( WINDOW *win);
|
||||
|
||||
extern int16 old_browser_size;
|
||||
extern int16 old_preview_area_size;
|
||||
extern int16 x_space;
|
||||
extern int16 y_space;
|
||||
extern int16 hcell;
|
||||
extern int16 border_size;
|
||||
extern int16 old_border_size;
|
||||
extern int16 need_frame_slider;
|
||||
extern int16 draw_frame_slider;
|
||||
extern OBJECT *frame_slider_root;
|
||||
|
||||
91
sources/z-tools/trunk/zview/catalog/catalog_entry.c
Normal file
91
sources/z-tools/trunk/zview/catalog/catalog_entry.c
Normal file
@@ -0,0 +1,91 @@
|
||||
#include "../general.h"
|
||||
|
||||
/* Prototype */
|
||||
void add_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
void remove_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
boolean check_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
void remove_all_selected_entry( WINDICON *wicones);
|
||||
int16 return_entry_nbr( WINDICON *wicones, Entry *entry);
|
||||
|
||||
|
||||
void add_selected_entry( WINDICON *wicones, Entry *entry)
|
||||
{
|
||||
Entry *ptr = wicones->first_selected;
|
||||
|
||||
if ( ptr == NULL)
|
||||
wicones->first_selected = entry;
|
||||
else
|
||||
{
|
||||
while( ptr->next_selected)
|
||||
ptr = ptr->next_selected;
|
||||
|
||||
ptr->next_selected = entry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void remove_selected_entry( WINDICON *wicones, Entry *entry)
|
||||
{
|
||||
Entry* ptr = wicones->first_selected;
|
||||
|
||||
if ( ptr == entry)
|
||||
wicones->first_selected = ptr->next_selected;
|
||||
else
|
||||
{
|
||||
while ( ptr->next_selected)
|
||||
{
|
||||
if ( ptr->next_selected == entry)
|
||||
break;
|
||||
else
|
||||
ptr = ptr->next_selected;
|
||||
}
|
||||
|
||||
if ( ptr->next_selected == entry)
|
||||
ptr->next_selected = ptr->next_selected->next_selected;
|
||||
}
|
||||
|
||||
entry->next_selected = NULL;
|
||||
}
|
||||
|
||||
|
||||
boolean check_selected_entry( WINDICON *wicones, Entry *entry)
|
||||
{
|
||||
Entry* ptr = wicones->first_selected;
|
||||
|
||||
if ( ptr == NULL)
|
||||
return FALSE;
|
||||
|
||||
if ( ptr == entry)
|
||||
return TRUE;
|
||||
|
||||
while ( ptr->next_selected)
|
||||
{
|
||||
if ( ptr->next_selected == entry)
|
||||
return TRUE;
|
||||
else
|
||||
ptr = ptr->next_selected;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void remove_all_selected_entry( WINDICON *wicones)
|
||||
{
|
||||
while( wicones->first_selected)
|
||||
wicones->first_selected = wicones->first_selected->next_selected;
|
||||
}
|
||||
|
||||
|
||||
int16 return_entry_nbr( WINDICON *wicones, Entry *entry)
|
||||
{
|
||||
int16 i;
|
||||
|
||||
if ( entry == NULL)
|
||||
return ( -1);
|
||||
|
||||
for ( i = 0 ; i < wicones->nbr_icons; i++)
|
||||
if ( entry == &wicones->entry[i])
|
||||
break;
|
||||
|
||||
return i;
|
||||
}
|
||||
6
sources/z-tools/trunk/zview/catalog/catalog_entry.h
Normal file
6
sources/z-tools/trunk/zview/catalog/catalog_entry.h
Normal file
@@ -0,0 +1,6 @@
|
||||
extern void add_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
extern void remove_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
extern boolean check_selected_entry( WINDICON *wicones, Entry *entry);
|
||||
extern void remove_all_selected_entry( WINDICON *wicones);
|
||||
extern int16 return_entry_nbr( WINDICON *wicones, Entry *entry);
|
||||
|
||||
38
sources/z-tools/trunk/zview/catalog/catalog_iconify.c
Normal file
38
sources/z-tools/trunk/zview/catalog/catalog_iconify.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "../general.h"
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void catalog_iconify: *
|
||||
* Function changes the window's name when the catalog window is iconified. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> the window to handle. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void catalog_iconify( WINDOW *win)
|
||||
{
|
||||
WindSetStr( win, WF_NAME, "Zview");
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void catalog_uniconify: *
|
||||
* Function restore the window's name when the catalog window is uniconified. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> the window to handle. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void catalog_uniconify( WINDOW *win)
|
||||
{
|
||||
WINDICON *wicones = ( WINDICON *)DataSearch( win, WD_ICON);
|
||||
|
||||
WindSetStr( win, WF_NAME, wicones->directory);
|
||||
}
|
||||
|
||||
3
sources/z-tools/trunk/zview/catalog/catalog_iconify.h
Normal file
3
sources/z-tools/trunk/zview/catalog/catalog_iconify.h
Normal file
@@ -0,0 +1,3 @@
|
||||
extern void catalog_iconify( WINDOW *win);
|
||||
extern void catalog_uniconify( WINDOW *win);
|
||||
|
||||
416
sources/z-tools/trunk/zview/catalog/catalog_icons.c
Normal file
416
sources/z-tools/trunk/zview/catalog/catalog_icons.c
Normal file
@@ -0,0 +1,416 @@
|
||||
#include "../general.h"
|
||||
#include "../ztext.h"
|
||||
#include "../mfdb.h"
|
||||
#include "catalog_entry.h"
|
||||
#include "../plugins.h"
|
||||
|
||||
/* Global variable */
|
||||
IMAGE icon_image;
|
||||
IMAGE icon_file;
|
||||
IMAGE icon_folder;
|
||||
IMAGE icon_prg;
|
||||
IMAGE icon_pdf;
|
||||
|
||||
IMAGE small_icon;
|
||||
|
||||
MFDB mini_hdd = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_folder = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_big = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_big_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_small = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_small_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_forward = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_forward_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_back = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_back_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_up = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_up_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_reload = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_reload_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_printer = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_printer_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_info = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_info_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_find = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_find_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_delete = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_delete_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_fullscreen = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_fullscreen_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_open = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_open_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_save = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
MFDB mini_save_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
|
||||
|
||||
/* local variable */
|
||||
static uint16 initialised = 0;
|
||||
|
||||
/* extern variable */
|
||||
extern int16 draw_frame_slider;
|
||||
|
||||
/* Prototype */
|
||||
void icons_exit(void);
|
||||
int16 icons_init( void);
|
||||
void set_entry_icon( Entry *entry);
|
||||
void redraw_icon( WINDOW *win, Entry *entry);
|
||||
void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect);
|
||||
boolean icon_is_visible( Entry *entry, int16 window_height);
|
||||
int16 redraw_icon_border( WINDOW *win, Entry *entry, int16 selected);
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void icons_exit: *
|
||||
* Free the memories previously allocated for the icon and pattern. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void icons_exit(void)
|
||||
{
|
||||
if ( initialised != 0)
|
||||
{
|
||||
( void)delete_mfdb( small_icon.image, small_icon.page);
|
||||
( void)delete_mfdb( icon_pdf.image, icon_pdf.page);
|
||||
( void)delete_mfdb( icon_prg.image, icon_prg.page);
|
||||
( void)delete_mfdb( icon_file.image, icon_file.page);
|
||||
( void)delete_mfdb( icon_image.image, icon_image.page);
|
||||
( void)delete_mfdb( icon_folder.image, icon_folder.page);
|
||||
}
|
||||
initialised = 0;
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* int16 icons_init: *
|
||||
* Initializes default icons and pattern. *
|
||||
* May be called any number of times. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* 0 if error else 1. *
|
||||
*==================================================================================*/
|
||||
|
||||
int16 icons_init( void)
|
||||
{
|
||||
uint16 *small_icon_buffer_addr;
|
||||
uint32 small_icon_buffer_size;
|
||||
initialised += 1;
|
||||
|
||||
if ( initialised == 1)
|
||||
{
|
||||
icon_image.view_mode = full_size;
|
||||
icon_file.view_mode = full_size;
|
||||
icon_folder.view_mode = full_size;
|
||||
icon_prg.view_mode = full_size;
|
||||
icon_pdf.view_mode = full_size;
|
||||
|
||||
icon_image.progress_bar = 0;
|
||||
icon_file.progress_bar = 0;
|
||||
icon_folder.progress_bar = 0;
|
||||
icon_prg.progress_bar = 0;
|
||||
icon_pdf.progress_bar = 0;
|
||||
|
||||
|
||||
small_icon.view_mode = full_size;
|
||||
small_icon.progress_bar = 0;
|
||||
|
||||
|
||||
if ( !pic_load( "icons\\folder.god","GOD", &icon_folder) ||
|
||||
!pic_load( "icons\\image.god", "GOD", &icon_image) ||
|
||||
!pic_load( "icons\\file.god", "GOD", &icon_file) ||
|
||||
!pic_load( "icons\\prg.god", "GOD", &icon_prg) ||
|
||||
!pic_load( "icons\\pdf.god", "GOD", &icon_pdf) ||
|
||||
!pic_load( "icons\\small.god", "GOD", &small_icon))
|
||||
{
|
||||
icons_exit();
|
||||
return( 0);
|
||||
}
|
||||
}
|
||||
|
||||
small_icon_buffer_addr = ( uint16*)small_icon.image[0].fd_addr;
|
||||
small_icon_buffer_size = app.nplanes << 4;
|
||||
|
||||
mini_hdd.fd_nplanes = app.nplanes;
|
||||
mini_hdd.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_folder.fd_nplanes = app.nplanes;
|
||||
mini_folder.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_big.fd_nplanes = app.nplanes;
|
||||
mini_big.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_big_on.fd_nplanes = app.nplanes;
|
||||
mini_big_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_small.fd_nplanes = app.nplanes;
|
||||
mini_small.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_small_on.fd_nplanes= app.nplanes;
|
||||
mini_small_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_forward.fd_nplanes = app.nplanes;
|
||||
mini_forward.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_forward_on.fd_nplanes = app.nplanes;
|
||||
mini_forward_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_back.fd_nplanes = app.nplanes;
|
||||
mini_back.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_back_on.fd_nplanes = app.nplanes;
|
||||
mini_back_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_up.fd_nplanes = app.nplanes;
|
||||
mini_up.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_up_on.fd_nplanes = app.nplanes;
|
||||
mini_up_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_reload.fd_nplanes = app.nplanes;
|
||||
mini_reload.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_reload_on.fd_nplanes = app.nplanes;
|
||||
mini_reload_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_printer.fd_nplanes = app.nplanes;
|
||||
mini_printer.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_printer_on.fd_nplanes = app.nplanes;
|
||||
mini_printer_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_info.fd_nplanes = app.nplanes;
|
||||
mini_info.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_info_on.fd_nplanes = app.nplanes;
|
||||
mini_info_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_find.fd_nplanes = app.nplanes;
|
||||
mini_find.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_find_on.fd_nplanes = app.nplanes;
|
||||
mini_find_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_delete.fd_nplanes = app.nplanes;
|
||||
mini_delete.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_delete_on.fd_nplanes= app.nplanes;
|
||||
mini_delete_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_fullscreen.fd_nplanes= app.nplanes;
|
||||
mini_fullscreen.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_fullscreen_on.fd_nplanes= app.nplanes;
|
||||
mini_fullscreen_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_open.fd_nplanes = app.nplanes;
|
||||
mini_open.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_open_on.fd_nplanes = app.nplanes;
|
||||
mini_open_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_save.fd_nplanes = app.nplanes;
|
||||
mini_save.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
small_icon_buffer_addr += small_icon_buffer_size;
|
||||
mini_save_on.fd_nplanes = app.nplanes;
|
||||
mini_save_on.fd_addr = ( void*)small_icon_buffer_addr;
|
||||
|
||||
return( 1);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void set_entry_icon: *
|
||||
* Set the entry's icon. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* entry -> pointer to the entry to set *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void set_entry_icon( Entry *entry)
|
||||
{
|
||||
int16 i, j, c = 0;
|
||||
char extention[4], plugin[4];
|
||||
|
||||
strcpy( extention, entry->name + strlen( entry->name) - 3);
|
||||
|
||||
str2upper( extention);
|
||||
|
||||
if ( S_ISDIR( entry->stat.st_mode))
|
||||
{
|
||||
entry->type = ET_DIR;
|
||||
entry->icon = icon_folder.image;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(( strncmp ( extention, "TTP", 3) == 0)
|
||||
|| ( strncmp ( extention, "TOS", 3) == 0)
|
||||
|| ( strncmp ( extention, "GTP", 3) == 0)
|
||||
|| ( strncmp ( extention, "PRG", 3) == 0)
|
||||
|| ( strncmp ( extention, "APP", 3) == 0))
|
||||
{
|
||||
entry->type = ET_PRG;
|
||||
entry->icon = &icon_prg.image[0];
|
||||
return;
|
||||
}
|
||||
|
||||
if( strncmp ( extention, "PDF", 3) == 0)
|
||||
{
|
||||
entry->type = ET_PDF;
|
||||
entry->icon = &icon_pdf.image[0];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for( i = 0; i < plugins_nbr; i++, c = 0)
|
||||
{
|
||||
for( j = 0; j < codecs[i]->user_ext; j++)
|
||||
{
|
||||
plugin[0] = codecs[i]->infos[c++];
|
||||
plugin[1] = codecs[i]->infos[c++];
|
||||
plugin[2] = codecs[i]->infos[c++];
|
||||
|
||||
if( strncmp ( extention, plugin, 3) == 0)
|
||||
{
|
||||
entry->type = ET_IMAGE;
|
||||
entry->icon = &icon_image.image[0];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entry->type = ET_FILE;
|
||||
entry->icon = &icon_file.image[0];
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void redraw_icon: *
|
||||
* send a redraw event at the entry's position. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> the target window. *
|
||||
* entry -> the icon to be redraw. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: - *
|
||||
*==================================================================================*/
|
||||
|
||||
void redraw_icon( WINDOW *win, Entry *entry)
|
||||
{
|
||||
int16 xw, yw, hw, x, y, w, h;
|
||||
|
||||
WindGet ( win, WF_WORKXYWH, &xw, &yw, &w, &hw);
|
||||
|
||||
x = entry->case_pos.x1 - 2;
|
||||
y = entry->case_pos.y1 - 1;
|
||||
w = entry->case_pos.x2 - x + 4;
|
||||
h = entry->case_pos.y2 - y + 2;
|
||||
|
||||
x += xw;
|
||||
y += yw;
|
||||
|
||||
if (( y + entry->case_pos.y2 > yw) && ( y < yw + hw))
|
||||
{
|
||||
draw_frame_slider = 0;
|
||||
draw_page( win, x, y, w, h);
|
||||
draw_frame_slider = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void draw_icon: *
|
||||
* draw a icon. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* handle -> the target VDI handle. *
|
||||
* entry -> the icon entry to be draw. *
|
||||
* selected -> the icon is selected or not. *
|
||||
* dst_rect -> Destination Bitmap for the icon. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: - *
|
||||
*==================================================================================*/
|
||||
|
||||
void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect)
|
||||
{
|
||||
MFDB *icon = ( entry->preview.page ? &entry->preview.image[0] : entry->icon),
|
||||
screen = {0};
|
||||
int16 xy[8], color[2] = { BLACK, WHITE};
|
||||
|
||||
|
||||
/* Source Rectangle */
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = icon->fd_w - 1;
|
||||
xy[3] = icon->fd_h - 1;
|
||||
|
||||
/* destination Rectangle */
|
||||
xy[4] = dst_rect->x1;
|
||||
xy[5] = dst_rect->y1;
|
||||
xy[6] = dst_rect->x2;
|
||||
xy[7] = dst_rect->y2;
|
||||
|
||||
|
||||
if ( icon->fd_nplanes == 1)
|
||||
vrt_cpyfm( handle, MD_REPLACE, xy, icon, &screen, color);
|
||||
else
|
||||
vro_cpyfm( handle, S_ONLY, xy, icon, &screen);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* boolean icon_is_visible: *
|
||||
* check if the icon is visible. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* entry -> the icon entry to be checked. *
|
||||
* window_height -> the window height. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: TRUE if visible else FALSE. *
|
||||
*==================================================================================*/
|
||||
|
||||
boolean icon_is_visible( Entry *entry, int16 window_height)
|
||||
{
|
||||
if ( ( entry->case_pos.y2 > 1) && ( entry->case_pos.y1 < window_height))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
43
sources/z-tools/trunk/zview/catalog/catalog_icons.h
Normal file
43
sources/z-tools/trunk/zview/catalog/catalog_icons.h
Normal file
@@ -0,0 +1,43 @@
|
||||
extern int16 icons_init( void);
|
||||
extern void icons_exit(void);
|
||||
extern void set_entry_icon( Entry *entry);
|
||||
extern void redraw_icon( WINDOW *wind, Entry *entry);
|
||||
extern void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect);
|
||||
extern boolean icon_is_visible( Entry *entry, int16 window_height);
|
||||
|
||||
extern IMAGE icon_image;
|
||||
extern IMAGE icon_file;
|
||||
extern IMAGE icon_folder;
|
||||
extern IMAGE icon_tos;
|
||||
extern IMAGE icon_pdf;
|
||||
|
||||
extern MFDB mini_hdd;
|
||||
extern MFDB mini_folder;
|
||||
extern MFDB mini_big;
|
||||
extern MFDB mini_big_on;
|
||||
extern MFDB mini_small;
|
||||
extern MFDB mini_small_on;
|
||||
extern MFDB mini_forward;
|
||||
extern MFDB mini_forward_on;
|
||||
extern MFDB mini_back;
|
||||
extern MFDB mini_back_on;
|
||||
extern MFDB mini_up;
|
||||
extern MFDB mini_up_on;
|
||||
extern MFDB mini_reload;
|
||||
extern MFDB mini_reload_on;
|
||||
extern MFDB mini_printer;
|
||||
extern MFDB mini_printer_on;
|
||||
extern MFDB mini_info;
|
||||
extern MFDB mini_info_on;
|
||||
extern MFDB mini_find;
|
||||
extern MFDB mini_find_on;
|
||||
extern MFDB mini_delete;
|
||||
extern MFDB mini_delete_on;
|
||||
extern MFDB mini_fullscreen;
|
||||
extern MFDB mini_fullscreen_on;
|
||||
extern MFDB mini_open;
|
||||
extern MFDB mini_open_on;
|
||||
extern MFDB mini_save;
|
||||
extern MFDB mini_save_on;
|
||||
|
||||
|
||||
465
sources/z-tools/trunk/zview/catalog/catalog_keyb.c
Normal file
465
sources/z-tools/trunk/zview/catalog/catalog_keyb.c
Normal file
@@ -0,0 +1,465 @@
|
||||
#include "../general.h"
|
||||
#include "../prefs.h"
|
||||
#include "../zedit/zedit.h"
|
||||
#include "../file/file.h"
|
||||
#include "../file/count.h"
|
||||
#include "../file/delete.h"
|
||||
#include "../file/rename.h"
|
||||
#include "../ztext.h"
|
||||
#include "catalog_entry.h"
|
||||
#include "catalog_mini_entry.h"
|
||||
#include "catalog_icons.h"
|
||||
#include "../pic_load.h"
|
||||
#include "../winimg.h"
|
||||
#include "catalog.h"
|
||||
#include "../mfdb.h"
|
||||
#include "../custom_font.h"
|
||||
|
||||
/* local constant */
|
||||
static const char allowed_char[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789 &\"'(<28>!)-_`<60>^[]*{},?;.:/=+%#|@~<>";
|
||||
char fullname[MAX_PATH+MAXNAMLEN];
|
||||
|
||||
/* Prototype */
|
||||
void WinCatalog_Keyb( WINDOW *win);
|
||||
|
||||
// extern boolean create_icon( const char *filename, MFDB *icon, MFDB *icon_selected, MFDB *icon_mask);
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Keyb: *
|
||||
* this function handle the keyboard event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The window to handle. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Keyb( WINDOW *win)
|
||||
{
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
Mini_Entry *old_selected;
|
||||
Entry *old_entry = wicones->first_selected;
|
||||
int16 res, selection, x, y, w, h, i;
|
||||
char old_dir[128] = "";
|
||||
|
||||
switch ( evnt.keybd >> 8)
|
||||
{
|
||||
case SC_UPARW:
|
||||
case SC_DWARW:
|
||||
case SC_LFARW:
|
||||
case SC_RTARW:
|
||||
case SC_RETURN:
|
||||
case SC_ENTER:
|
||||
case SC_HOME:
|
||||
if( wicones->first_selected)
|
||||
{
|
||||
if( wicones->first_selected->next_selected)
|
||||
{
|
||||
Entry *entry_ptr;
|
||||
|
||||
while( wicones->first_selected->next_selected)
|
||||
{
|
||||
entry_ptr = wicones->first_selected->next_selected;
|
||||
remove_selected_entry( wicones, wicones->first_selected->next_selected);
|
||||
redraw_icon( win, entry_ptr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
WindGet ( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
if ( !wicones->edit)
|
||||
{
|
||||
res = selection = return_entry_nbr( wicones, wicones->first_selected);
|
||||
|
||||
switch ( evnt.keybd >> 8)
|
||||
{
|
||||
case SC_UPARW:
|
||||
if ( selection == -1)
|
||||
selection = 0;
|
||||
else if ( selection >= wicones->columns)
|
||||
selection = selection - wicones->columns;
|
||||
|
||||
goto common;
|
||||
|
||||
case SC_DWARW:
|
||||
if ( selection == -1)
|
||||
selection = 0;
|
||||
else if ( selection < wicones->nbr_icons - wicones->icons_last_line && selection + wicones->columns < wicones->nbr_icons)
|
||||
selection = selection + wicones->columns;
|
||||
|
||||
goto common;
|
||||
|
||||
case SC_LFARW:
|
||||
if ( selection == -1)
|
||||
selection = 0;
|
||||
else if ( selection > 0)
|
||||
selection--;
|
||||
|
||||
goto common;
|
||||
|
||||
case SC_RTARW:
|
||||
if ( selection == -1)
|
||||
selection = 0;
|
||||
else if ( selection < wicones->nbr_icons - 1)
|
||||
selection++;
|
||||
|
||||
common:
|
||||
|
||||
if ( wicones->entry[selection].icn_pos.y1 < 0)
|
||||
{
|
||||
if ( wicones->entry[selection].icn_pos.y1 + wicones->case_h >= 0)
|
||||
{
|
||||
wicones->first_selected = &wicones->entry[selection];
|
||||
|
||||
if ( res >= 0)
|
||||
redraw_icon( win, &wicones->entry[res]);
|
||||
|
||||
snd_arrw( win, WA_UPLINE);
|
||||
/* WindMakePreview( win); */
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( wicones->entry[selection].icn_pos.y1 <= 0)
|
||||
{
|
||||
if ( win->ypos == 0)
|
||||
break;
|
||||
|
||||
wicones->entry[selection].icn_pos.y1 += wicones->case_h;
|
||||
win->ypos--;
|
||||
}
|
||||
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
goto end_case;
|
||||
}
|
||||
}
|
||||
else if ( wicones->entry[selection].icn_pos.y2 > h)
|
||||
{
|
||||
if ( wicones->entry[selection].icn_pos.y2 - wicones->case_h <= h)
|
||||
{
|
||||
wicones->first_selected = &wicones->entry[selection];
|
||||
|
||||
snd_arrw( win, WA_DNLINE);
|
||||
|
||||
if ( res >= 0)
|
||||
redraw_icon( win, &wicones->entry[res]);
|
||||
|
||||
redraw_icon( win, wicones->first_selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( wicones->entry[selection].icn_pos.y2 >= h)
|
||||
{
|
||||
if ( win->ypos == win->ypos_max)
|
||||
break;
|
||||
|
||||
wicones->entry[selection].icn_pos.y2 -= wicones->case_h;
|
||||
win->ypos++;
|
||||
}
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
goto end_case;
|
||||
}
|
||||
}
|
||||
else if ( res != selection)
|
||||
{
|
||||
wicones->first_selected = &wicones->entry[selection];
|
||||
|
||||
if ( res >= 0)
|
||||
redraw_icon( win, &wicones->entry[res]);
|
||||
|
||||
redraw_icon( win, wicones->first_selected);
|
||||
}
|
||||
|
||||
end_case:
|
||||
|
||||
break;
|
||||
|
||||
case SC_RETURN:
|
||||
case SC_ENTER:
|
||||
if( !wicones->first_selected)
|
||||
break;
|
||||
else if ( wicones->entry[selection].type == ET_DIR)
|
||||
{
|
||||
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
|
||||
|
||||
wicones->mini_selected = NULL;
|
||||
|
||||
if ( old_selected_mini_entry && browser_frame_width)
|
||||
redraw_mini_entry( win, old_selected_mini_entry);
|
||||
|
||||
strcat( wicones->directory, wicones->entry[selection].name);
|
||||
( void)scan_dir( win, wicones->directory);
|
||||
WindSetStr ( win, WF_NAME, wicones->directory);
|
||||
wicones->first_selected = NULL;
|
||||
win->ypos = 0;
|
||||
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
}
|
||||
else if ( ( wicones->entry[selection].type == ET_IMAGE && wicones->entry[selection].preview.page) || wicones->entry[selection].type == ET_PDF)
|
||||
{
|
||||
strcpy( fullname, wicones->directory);
|
||||
strcat( fullname, wicones->entry[selection].name);
|
||||
WindView( fullname);
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_HOME:
|
||||
if ( !dir_parent( wicones->directory, old_dir))
|
||||
break;
|
||||
|
||||
old_selected = wicones->mini_selected;
|
||||
wicones->mini_selected = NULL;
|
||||
|
||||
if ( old_selected)
|
||||
redraw_mini_entry( win, old_selected);
|
||||
|
||||
( void)scan_dir( win, wicones->directory);
|
||||
|
||||
WindSetStr ( win, WF_NAME, wicones->directory);
|
||||
win->ypos = 0;
|
||||
|
||||
for (i = 0 ; i < wicones->nbr_icons ; i++)
|
||||
if ( !strcmp( wicones->entry[i].name, old_dir))
|
||||
{
|
||||
wicones->first_selected = &wicones->entry[i];
|
||||
break;
|
||||
}
|
||||
|
||||
WinCatalog_Refresh( win);
|
||||
|
||||
if ( wicones->first_selected->txt_pos.y2 > h)
|
||||
while ( wicones->first_selected->txt_pos.y2 + wicones->case_h > h)
|
||||
{
|
||||
wicones->first_selected->txt_pos.y2 -= wicones->case_h;
|
||||
win->ypos++;
|
||||
}
|
||||
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case SC_DEL:
|
||||
if ( wicones->first_selected)
|
||||
delete_entry( win);
|
||||
break;
|
||||
|
||||
/* case SC_F1:
|
||||
{
|
||||
Entry *entry_ptr = wicones->first_selected;
|
||||
|
||||
while( entry_ptr)
|
||||
{
|
||||
zdebug( "entry = %s", entry_ptr);
|
||||
entry_ptr = entry_ptr->next_selected;
|
||||
}
|
||||
zdebug( "---");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case SC_F3:
|
||||
{
|
||||
MFDB nicon, nicon_selected, icon_mask, screen = {0};
|
||||
int16 xy[8], fvdi = 1;
|
||||
|
||||
if( create_icon( "c://1.gif", &nicon, &nicon_selected, &icon_mask))
|
||||
{
|
||||
int16 color[2], blitmode;
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = nicon.fd_w - 1;
|
||||
xy[3] = nicon.fd_h - 1;
|
||||
|
||||
xy[4] = 40;
|
||||
xy[5] = 40;
|
||||
xy[6] += nicon.fd_w - 1;
|
||||
xy[7] += nicon.fd_h - 1;
|
||||
|
||||
vro_cpyfm( app.handle, S_ONLY, xy, &nicon, &screen);
|
||||
|
||||
xy[4] += nicon.fd_w - 1;
|
||||
xy[6] += nicon.fd_h - 1;
|
||||
|
||||
vro_cpyfm( app.handle, S_ONLY, xy, &nicon_selected, &screen);
|
||||
|
||||
xy[4] += nicon.fd_w - 1;
|
||||
xy[6] += nicon.fd_h - 1;
|
||||
|
||||
color[0] = WHITE;
|
||||
color[1] = BLACK;
|
||||
|
||||
vrt_cpyfm( app.handle, MD_REPLACE, xy, &icon_mask, &screen, color);
|
||||
|
||||
|
||||
xy[4] += nicon.fd_w - 1;
|
||||
xy[6] += nicon.fd_h - 1;
|
||||
|
||||
blitmode = app.nplanes > 8 ? S_AND_D : S_OR_D;
|
||||
|
||||
if( fvdi)
|
||||
{
|
||||
color[0] = WHITE;
|
||||
color[1] = BLACK;
|
||||
vrt_cpyfm( app.handle, 4, xy, &icon_mask, &screen, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
color[0] = BLACK;
|
||||
color[1] = WHITE;
|
||||
vrt_cpyfm( app.handle, MD_TRANS, xy, &icon_mask, &screen, color);
|
||||
}
|
||||
|
||||
vro_cpyfm( app.handle, S_OR_D, xy, &nicon, &screen);
|
||||
|
||||
delete_mfdb( &nicon);
|
||||
delete_mfdb( &nicon_selected);
|
||||
delete_mfdb( &icon_mask);
|
||||
|
||||
}
|
||||
else
|
||||
zdebug("error");
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_F4:
|
||||
{
|
||||
int16 mode = mode2logic( T_TRANSPARENT);
|
||||
|
||||
zdebug( "%i", mode);
|
||||
}
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( !( wicones->first_selected))
|
||||
{
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
|
||||
|
||||
if( old_entry)
|
||||
{
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
|
||||
|
||||
if( old_entry->type == ET_IMAGE)
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wicones->first_selected->type == ET_IMAGE)
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 1);
|
||||
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 1);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 1);
|
||||
|
||||
if( !old_entry)
|
||||
{
|
||||
if( wicones->first_selected->type == ET_IMAGE)
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
|
||||
}
|
||||
else if(( wicones->first_selected->type != old_entry->type) && ( wicones->first_selected->type == ET_IMAGE || old_entry->type == ET_IMAGE))
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
}
|
||||
}
|
||||
else if ( wicones->edit)
|
||||
{
|
||||
Mini_Entry *mini_ptr = NULL;
|
||||
int16 c = evnt.keybd & 0x00FF;
|
||||
int16 max_len = ( int16)Dpathconf( wicones->directory, 3);
|
||||
|
||||
switch( evnt.keybd >> 8)
|
||||
{
|
||||
case SC_RETURN:
|
||||
case SC_ENTER:
|
||||
if ( wicones->first_selected->type == ET_DIR)
|
||||
{
|
||||
strcpy( fullname, wicones->directory);
|
||||
strcat( fullname, wicones->first_selected->name);
|
||||
strcat( fullname, "\\");
|
||||
}
|
||||
|
||||
if( !rename_entry( win, wicones->edit->top->buf))
|
||||
{
|
||||
exit_edit_mode( win, wicones->first_selected);
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy( wicones->first_selected->name_shown, wicones->first_selected->name);
|
||||
|
||||
if (( wicones->first_selected->icon_txt_w = get_text_width( wicones->first_selected->name_shown)) >= wicones->case_w - 4)
|
||||
wicones->first_selected->icon_txt_w = name_shorter( wicones->case_w - 6, wicones->first_selected->name_shown);
|
||||
|
||||
exit_edit_mode( win, wicones->first_selected);
|
||||
|
||||
// Now, we change the name of the dir in the file browser if necessary( left frame).
|
||||
if ( wicones->first_selected->type != ET_DIR)
|
||||
break;
|
||||
|
||||
if (( mini_ptr = find_mini_entry_by_path( wicones, fullname)) != NULL)
|
||||
{
|
||||
strcpy( mini_ptr->foldername, mini_ptr->parent->foldername);
|
||||
strcat( mini_ptr->foldername, wicones->first_selected->name);
|
||||
strcat( mini_ptr->foldername, "\\");
|
||||
strcpy( mini_ptr->name, wicones->first_selected->name);
|
||||
mini_ptr->icon_txt_w = get_text_width( mini_ptr->name);
|
||||
mini_ptr->icon_position.x2 = mini_ptr->icon_position.x1 + 15 + x_space + mini_ptr->icon_txt_w;
|
||||
|
||||
if( browser_frame_width)
|
||||
redraw_mini_entry( win, mini_ptr);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SC_LFARW:
|
||||
if ( curs_left( wicones->edit))
|
||||
edit_icon_txt( win, wicones->first_selected);
|
||||
break;
|
||||
|
||||
case SC_RTARW:
|
||||
if ( curs_right( wicones->edit))
|
||||
edit_icon_txt( win, wicones->first_selected);
|
||||
break;
|
||||
|
||||
case SC_UPARW:
|
||||
case SC_DWARW:
|
||||
case SC_ESC:
|
||||
exit_edit_mode( win, wicones->first_selected);
|
||||
break;
|
||||
|
||||
case SC_DEL:
|
||||
curs_right( wicones->edit);
|
||||
case SC_BACK:
|
||||
if ( char_del( wicones->edit) != 0)
|
||||
edit_icon_txt( win, wicones->first_selected);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (( wicones->edit->top->len < max_len || wicones->edit->top->len > 10000) && strchr( allowed_char, c))
|
||||
{
|
||||
char_put ( wicones->edit, c);
|
||||
edit_icon_txt( win, wicones->first_selected);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
sources/z-tools/trunk/zview/catalog/catalog_keyb.h
Normal file
2
sources/z-tools/trunk/zview/catalog/catalog_keyb.h
Normal file
@@ -0,0 +1,2 @@
|
||||
extern void WinCatalog_Keyb( WINDOW *win);
|
||||
|
||||
570
sources/z-tools/trunk/zview/catalog/catalog_mini_entry.c
Normal file
570
sources/z-tools/trunk/zview/catalog/catalog_mini_entry.c
Normal file
@@ -0,0 +1,570 @@
|
||||
#include "../general.h"
|
||||
#include "../prefs.h"
|
||||
#include "../custom_font.h"
|
||||
#include "catalog_icons.h"
|
||||
#include "catalog_entry.h"
|
||||
#include "../file/file.h"
|
||||
#include "catalog.h"
|
||||
|
||||
/* Prototype */
|
||||
void delete_mini_entry_child( Mini_Entry *entry);
|
||||
void redraw_mini_entry( WINDOW *win, Mini_Entry *entry);
|
||||
void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 xw, int16 yw, int16 hw);
|
||||
int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw);
|
||||
int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y);
|
||||
Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path);
|
||||
Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path);
|
||||
void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root);
|
||||
|
||||
/* extern variable */
|
||||
extern int16 need_frame_slider;
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* delete_mini_entry_child: *
|
||||
* Free the memory used by all the 'child' items of a mini entry and put the *
|
||||
* parent 'nbr_child' counter to zero. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* entry = the entry parent. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void delete_mini_entry_child( Mini_Entry *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* if nothing to do, end the function */
|
||||
if( entry->child == NULL)
|
||||
return;
|
||||
|
||||
/* make a loop to see if the childs mini entries have child, if it's true, delete it */
|
||||
for ( i = 0; i < entry->nbr_child ; i++)
|
||||
{
|
||||
if ( entry->child[i].nbr_child)
|
||||
delete_mini_entry_child( &entry->child[i]);
|
||||
}
|
||||
|
||||
/* Free the memory and put the counter to zero */
|
||||
gfree( entry->child);
|
||||
entry->child = NULL;
|
||||
entry->nbr_child = 0;
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* redraw_mini_entry: *
|
||||
* Send a redraw event for a mini_entry in the WINDOW *win. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win = the target window *
|
||||
* entry = the icon to be redraw *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void redraw_mini_entry( WINDOW *win, Mini_Entry *entry)
|
||||
{
|
||||
int16 xw, yw, hw, x, y, w, h;
|
||||
|
||||
WindGet ( win, WF_WORKXYWH, &xw, &yw, &w, &hw);
|
||||
|
||||
x = entry->arrow_position.x1;
|
||||
y = entry->icon_position.y1;
|
||||
w = entry->icon_position.x2 - entry->icon_position.x1 + 20;
|
||||
h = entry->icon_position.y2 - y + 1;
|
||||
|
||||
x += xw;
|
||||
y += yw;
|
||||
|
||||
/* send the redraw event only if the mini entry is visible */
|
||||
if (( y + entry->icon_position.y2 > yw) && ( y < yw + hw))
|
||||
draw_page( win, x, y, MIN( w, browser_frame_width), h);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* draw_mini_entry: *
|
||||
* draw a mini_entry in the WINDOW *win. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* handle = the window's VDI handle. *
|
||||
* selected = the mini_entry to be draw. *
|
||||
* entry = pointer to the mini_entry selected. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 h)
|
||||
{
|
||||
MFDB *icon, screen = {0};
|
||||
int16 xy[8], xtext, ytext;
|
||||
|
||||
|
||||
if( ( entry->icon_position.y1 + y) < y || ( entry->icon_position.y1 + y) >= y + h)
|
||||
return;
|
||||
|
||||
/* DRAW ARROW IS NEEDED */
|
||||
if ( entry->state != UNKNOWN)
|
||||
{
|
||||
if ( entry->state == ON)
|
||||
{
|
||||
xy[0] = entry->arrow_position.x1 + x;
|
||||
xy[1] = entry->arrow_position.y1 + 3 + y;
|
||||
xy[2] = xy[0] + 10;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[0] + 5;
|
||||
xy[5] = xy[1] + 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
xy[0] = entry->arrow_position.x1 + x + 4;
|
||||
xy[1] = entry->arrow_position.y1 + y;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 10;
|
||||
xy[4] = xy[0] + 5;
|
||||
xy[5] = xy[1] + 5;
|
||||
}
|
||||
|
||||
vsf_color( win->graf.handle, LBLACK);
|
||||
v_fillarea( win->graf.handle, 3, xy);
|
||||
}
|
||||
|
||||
|
||||
/* DRAW ICON */
|
||||
if ( entry->parent)
|
||||
icon = &mini_folder;
|
||||
else
|
||||
{
|
||||
switch( entry->name[0])
|
||||
{
|
||||
case 'A':
|
||||
case 'B':
|
||||
icon = &mini_hdd;
|
||||
break;
|
||||
|
||||
default:
|
||||
icon = &mini_hdd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = 15;
|
||||
xy[3] = 15;
|
||||
xy[4] = entry->icon_position.x1 + x;
|
||||
xy[5] = entry->icon_position.y1 + y;
|
||||
xy[6] = xy[4] + 15;
|
||||
xy[7] = xy[5] + 15;
|
||||
|
||||
if ( icon->fd_nplanes == 1)
|
||||
{
|
||||
int16 color[2];
|
||||
|
||||
color[0] = WHITE;
|
||||
color[1] = BLACK;
|
||||
|
||||
vrt_cpyfm( win->graf.handle, MD_REPLACE, xy, icon, &screen, color);
|
||||
}
|
||||
else
|
||||
vro_cpyfm( win->graf.handle, S_ONLY, xy, icon, &screen);
|
||||
|
||||
|
||||
/* DRAW TEXT */
|
||||
xtext = entry->icon_position.x1 + x + 15 + x_space; /* column x position + arrow + icon + space */
|
||||
ytext = entry->icon_position.y1 + y + 4; /* line x postion + 1 + (( line height - font height) / 2) */
|
||||
|
||||
if ( entry == selected)
|
||||
{
|
||||
xy[0] = xtext - 2;
|
||||
xy[2] = xy[0] + entry->icon_txt_w + 4;
|
||||
xy[1] = ytext - 1;
|
||||
xy[3] = xy[1] + hcell + 2;
|
||||
|
||||
vsf_color( win->graf.handle, BLACK);
|
||||
v_bar( win->graf.handle, xy);
|
||||
|
||||
draw_text( win->graf.handle, xtext, ytext, WHITE, entry->name);
|
||||
}
|
||||
else
|
||||
draw_text( win->graf.handle, xtext, ytext, BLACK, entry->name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* calc_mini_entry_line: *
|
||||
* compute the number of line needed for entry's mini_entries's childs. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* entry = The parent mini_entry. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* number of lines needed *
|
||||
*==================================================================================*/
|
||||
|
||||
int16 calc_mini_entry_line( Mini_Entry *entry)
|
||||
{
|
||||
int16 i, lines = 0;
|
||||
|
||||
if( entry->child == NULL)
|
||||
return lines;
|
||||
|
||||
for ( i = 0; i < entry->nbr_child ; i++)
|
||||
{
|
||||
lines++;
|
||||
lines += calc_mini_entry_line( &entry->child[i]);
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* draw_mini_entry_child: *
|
||||
* draw every mini_entry's childs in the WINDOW *win. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win = the window where to draw. *
|
||||
* selected = pointer to the mini_entry selected. *
|
||||
* entry = The parent mini_entry. *
|
||||
* x = x window's position. *
|
||||
* y = y window's position. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* number of lines drawn *
|
||||
*==================================================================================*/
|
||||
|
||||
int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw)
|
||||
{
|
||||
int16 i, dum, lines = 0;
|
||||
|
||||
if( entry->child == NULL)
|
||||
return lines;
|
||||
|
||||
for ( i = 0; i < entry->nbr_child ; i++)
|
||||
{
|
||||
entry->child[i].arrow_position.x1 = x + 3;
|
||||
entry->child[i].arrow_position.y1 = y + 3;
|
||||
entry->child[i].arrow_position.x2 = entry->child[i].arrow_position.x1 + 11;
|
||||
entry->child[i].arrow_position.y2 = entry->child[i].arrow_position.y1 + 11;
|
||||
|
||||
entry->child[i].icon_position.x1 = x + 15;
|
||||
entry->child[i].icon_position.y1 = y + 1;
|
||||
entry->child[i].icon_position.x2 = entry->child[i].icon_position.x1 + 15 + x_space + entry->child[i].icon_txt_w;
|
||||
entry->child[i].icon_position.y2 = entry->child[i].icon_position.y1 + 15;
|
||||
|
||||
draw_mini_entry( win, selected, &entry->child[i], xw, yw, hw);
|
||||
lines++;
|
||||
|
||||
y += 18;
|
||||
|
||||
dum = draw_mini_entry_child( win, selected, &entry->child[i], x + 15, y, xw, yw, hw);
|
||||
|
||||
y += ( dum * 18);
|
||||
|
||||
lines += dum;
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* find_mini_entry_child_on_mouse: *
|
||||
* Look if the mouse click is on a entry's childs or on childs's arrow. *
|
||||
* If yes, open the mini_entry if the mouse is on the arrow or enter in the *
|
||||
* directory seleted and send a redraw event to the main frame if is on the *
|
||||
* entry itself. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win = the target window. *
|
||||
* entry = the mini_entry where search for childs'entry selected. *
|
||||
* mouse_x, mouse_y = the mouse position. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* 1 if the mini_entry selected is found or 0. *
|
||||
*==================================================================================*/
|
||||
|
||||
int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y)
|
||||
{
|
||||
int i;
|
||||
|
||||
if( entry->child == NULL)
|
||||
return( 0);
|
||||
|
||||
for ( i = 0; i < entry->nbr_child ; i++)
|
||||
{
|
||||
if ( entry->child[i].nbr_child > 0)
|
||||
if ( find_mini_entry_child_on_mouse( win, &entry->child[i], mouse_x, mouse_y))
|
||||
return ( 1);
|
||||
|
||||
if (( mouse_x >= entry->child[i].icon_position.x1 && mouse_x <= entry->child[i].icon_position.x2 && mouse_y >= entry->child[i].icon_position.y1 && mouse_y <= entry->child[i].icon_position.y2))
|
||||
{
|
||||
WINDICON *wicones = ( WINDICON *)DataSearch( win, WD_ICON);
|
||||
|
||||
if ( wicones->mini_selected != &entry->child[i])
|
||||
{
|
||||
Mini_Entry *old_selected = wicones->mini_selected;
|
||||
|
||||
wicones->mini_selected = &entry->child[i];
|
||||
|
||||
if ( old_selected)
|
||||
redraw_mini_entry( win, old_selected);
|
||||
|
||||
redraw_mini_entry( win, wicones->mini_selected);
|
||||
|
||||
if ( strcmp ( wicones->mini_selected->foldername, wicones->directory) != 0)
|
||||
{
|
||||
int16 x, y, w, h;
|
||||
|
||||
if ( wicones->first_selected)
|
||||
{
|
||||
while ( wicones->first_selected)
|
||||
remove_selected_entry( wicones, wicones->first_selected);
|
||||
}
|
||||
|
||||
graf_mouse( BUSYBEE, NULL);
|
||||
|
||||
( void)scan_dir( win, wicones->mini_selected->foldername);
|
||||
WindSetStr ( win, WF_NAME, wicones->directory);
|
||||
wicones->first_selected = NULL;
|
||||
win->ypos = 0;
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
draw_page( win, x + browser_frame_width, y, w - browser_frame_width, h);
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
return( 1);
|
||||
}
|
||||
else if ( entry->child[i].state != UNKNOWN)
|
||||
{
|
||||
if (( mouse_x >= entry->child[i].arrow_position.x1 && mouse_x <= entry->child[i].arrow_position.x2 && mouse_y >= entry->child[i].arrow_position.y1 && mouse_y <= entry->child[i].arrow_position.y2))
|
||||
{
|
||||
int16 x, y, h, w;
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
if ( entry->child[i].state == ON)
|
||||
{
|
||||
entry->child[i].state = OFF;
|
||||
delete_mini_entry_child( &entry->child[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mini_Entry *selected = &entry->child[i];
|
||||
|
||||
graf_mouse( BUSYBEE, NULL);
|
||||
|
||||
selected->state = ON;
|
||||
scan_mini_dir( win, selected);
|
||||
check_mini_dir( selected->nbr_child, selected->child);
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
}
|
||||
|
||||
WinCatalog_Refresh( win);
|
||||
draw_page( win, x, y, browser_frame_width, h);
|
||||
|
||||
return( 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return( 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* find_mini_entry_child_by_path: *
|
||||
* find a child mini_entry in parent and return it. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* parent = the parent where to search. *
|
||||
* path = the path of the mini_entry wanted. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* A pointer to the mini_entry if found else NULL. *
|
||||
*==================================================================================*/
|
||||
|
||||
Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path)
|
||||
{
|
||||
int i;
|
||||
|
||||
Mini_Entry *entry = NULL;
|
||||
|
||||
if( parent->child == NULL)
|
||||
return NULL;
|
||||
|
||||
/* make a loop to see if the childs mini entries have child, if it's true, check it */
|
||||
for ( i = 0; i < parent->nbr_child ; i++)
|
||||
{
|
||||
if ( parent->child[i].nbr_child)
|
||||
{
|
||||
if ( ( entry = find_mini_entry_child_by_path( &parent->child[i], path)))
|
||||
return entry;
|
||||
}
|
||||
|
||||
if ( strcmp ( parent->child[i].foldername, path) == 0)
|
||||
return &parent->child[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* find_mini_entry_by_path: *
|
||||
* find a mini_entry and return it. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* wicones = the WINDICON struct where to search. *
|
||||
* path = the path of the mini_entry wanted. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* A pointer to the mini_entry if found else NULL. *
|
||||
*==================================================================================*/
|
||||
|
||||
Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path)
|
||||
{
|
||||
Mini_Entry *entry = NULL;
|
||||
int16 i;
|
||||
|
||||
for ( i = 0; i < wicones->nbr_child; i++)
|
||||
{
|
||||
if ( wicones->root[i].nbr_child)
|
||||
{
|
||||
if ( ( entry = find_mini_entry_child_by_path( &wicones->root[i], path)))
|
||||
return entry;
|
||||
}
|
||||
|
||||
if ( strcmp ( wicones->root[i].foldername, path) == 0)
|
||||
return &wicones->root[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* recalc_mini_entry_child_txt_width: *
|
||||
* static function called by recalc_mini_entry_txt_width() *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* wicones = the WINDICON struct where to search. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
static void recalc_mini_entry_child_txt_width( Mini_Entry *parent)
|
||||
{
|
||||
int i;
|
||||
|
||||
if( parent->child == NULL)
|
||||
return;
|
||||
|
||||
/* make a loop to see if the childs mini entries have child, if it's true, make the job */
|
||||
for ( i = 0; i < parent->nbr_child; i++)
|
||||
{
|
||||
if ( parent->child[i].nbr_child)
|
||||
recalc_mini_entry_child_txt_width( &parent->child[i]);
|
||||
|
||||
parent->child[i].icon_txt_w = get_text_width( parent->child[i].name);
|
||||
parent->child[i].icon_position.x2 = parent->child[i].icon_position.x1 + 15 + x_space + parent->child[i].icon_txt_w;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* recalc_mini_entry_txt_width: *
|
||||
* After a font change, we need to recalc the mini_entry text width. *
|
||||
* This function do it. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* wicones = the WINDICON struct where to search. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void recalc_mini_entry_txt_width( WINDICON *wicones)
|
||||
{
|
||||
int16 i;
|
||||
|
||||
for ( i = 0; i < wicones->nbr_child; i++)
|
||||
{
|
||||
if ( wicones->root[i].nbr_child)
|
||||
recalc_mini_entry_child_txt_width( &wicones->root[i]);
|
||||
|
||||
wicones->root[i].icon_txt_w = get_text_width( wicones->root[i].name);
|
||||
|
||||
wicones->root[i].icon_position.x2 = wicones->root[i].icon_position.x1 + 15 + x_space + wicones->root[i].icon_txt_w;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* calc_mini_entry_slider: *
|
||||
* compute the frame slider size and coordinate. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* wicones = the target WINDICON struct. *
|
||||
* slider_root = the parent slider OBJECT. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* return: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root)
|
||||
{
|
||||
int16 max_mover_size = slider_root[SLIDERS_BACK].ob_height;
|
||||
int16 full_win_size = wicones->ypos_max * wicones->h_u;
|
||||
int16 win_h = slider_root->ob_height + 3;
|
||||
|
||||
if ( win_h >= full_win_size)
|
||||
{
|
||||
wicones -> ypos = 0;
|
||||
|
||||
slider_root[SLIDERS_MOVER].ob_y = 0;
|
||||
slider_root[SLIDERS_MOVER].ob_height = max_mover_size;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int16 ligne_reste;
|
||||
float mover_position = 0L;
|
||||
float position_step = 0L;
|
||||
float mover_size = MAX( ( float)max_mover_size * ( ( float)win_h / ( float)full_win_size), 10L);
|
||||
|
||||
if( wicones->ypos)
|
||||
{
|
||||
ligne_reste = wicones->ypos_max - ( win_h / wicones->h_u);
|
||||
position_step = (( float)max_mover_size - mover_size) / ( float)ligne_reste;
|
||||
mover_position = position_step * ( float)wicones->ypos;
|
||||
|
||||
while( (( int16)mover_size + ( int16)mover_position > max_mover_size) && wicones->ypos > 0)
|
||||
{
|
||||
wicones->ypos--;
|
||||
mover_position -= position_step;
|
||||
}
|
||||
}
|
||||
|
||||
slider_root[SLIDERS_MOVER].ob_height = ( int16)mover_size;
|
||||
slider_root[SLIDERS_MOVER].ob_y = ( int16)mover_position;
|
||||
}
|
||||
}
|
||||
10
sources/z-tools/trunk/zview/catalog/catalog_mini_entry.h
Normal file
10
sources/z-tools/trunk/zview/catalog/catalog_mini_entry.h
Normal file
@@ -0,0 +1,10 @@
|
||||
extern void delete_mini_entry_child( Mini_Entry *entry);
|
||||
extern int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y);
|
||||
extern void redraw_mini_entry( WINDOW *win, Mini_Entry *entry);
|
||||
extern void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 h);
|
||||
extern int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw);
|
||||
extern Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path);
|
||||
extern Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path);
|
||||
extern void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root);
|
||||
extern int16 calc_mini_entry_line( Mini_Entry *entry);
|
||||
extern void recalc_mini_entry_txt_width( WINDICON *wicones);
|
||||
527
sources/z-tools/trunk/zview/catalog/catalog_mouse.c
Normal file
527
sources/z-tools/trunk/zview/catalog/catalog_mouse.c
Normal file
@@ -0,0 +1,527 @@
|
||||
#include "../general.h"
|
||||
#include "../ztext.h"
|
||||
#include "catalog_entry.h"
|
||||
#include "catalog_mini_entry.h"
|
||||
#include "../prefs.h"
|
||||
#include "../infobox.h"
|
||||
#include "../pic_load.h"
|
||||
#include "../winimg.h"
|
||||
#include "../zedit/zedit.h"
|
||||
#include "../file/file.h"
|
||||
#include "catalog.h"
|
||||
#include "catalog_icons.h"
|
||||
#include "catalog_slider.h"
|
||||
#include "catalog_popup.h"
|
||||
|
||||
/* Local variable */
|
||||
static int16 dum;
|
||||
extern char fullname[MAX_PATH+MAXNAMLEN];
|
||||
|
||||
/* Prototype */
|
||||
void WinCatalog_Mouse( WINDOW *win);
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Mouse: *
|
||||
* this function handle the mouse event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The window to handle. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Mouse( WINDOW *win)
|
||||
{
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
GRECT mouse;
|
||||
int16 x, y, w, h, old_x, old_entry = 0, old_y, i = 0, nb_click, in_txt = 0, in_icn = 0, in_frame_border = 0, in_browser = 0;
|
||||
Entry *entry_ptr = NULL, *old_selected = wicones->first_selected;
|
||||
EntryType old_type = ET_FILE;
|
||||
|
||||
if( old_selected)
|
||||
{
|
||||
old_entry = 1;
|
||||
|
||||
old_type = old_selected->type;
|
||||
}
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
mouse.g_x = evnt.mx - x;
|
||||
mouse.g_y = evnt.my - y;
|
||||
old_x = evnt.mx;
|
||||
old_y = evnt.my;
|
||||
nb_click = evnt.nb_click;
|
||||
|
||||
if ( browser_frame_width && ( mouse.g_x >= wicones->border_position[0] && mouse.g_x <= wicones->border_position[1]))
|
||||
{ /* mouse on frame border */
|
||||
in_frame_border = 1;
|
||||
}
|
||||
else if ( browser_frame_width && ( mouse.g_x < wicones->border_position[0]))
|
||||
{ /* mouse on browser */
|
||||
in_browser = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0 ; i < wicones->nbr_icons ; i++) /* Check if the mouse is over a icon */
|
||||
{
|
||||
/* mouse on text */
|
||||
if (( mouse.g_x >= wicones->entry[i].txt_pos.x1 && mouse.g_x <= wicones->entry[i].txt_pos.x2 && mouse.g_y >= wicones->entry[i].txt_pos.y1 && mouse.g_y <= wicones->entry[i].txt_pos.y2))
|
||||
{
|
||||
in_txt = 1;
|
||||
break;
|
||||
}
|
||||
/* click on case to select */
|
||||
else if (( mouse.g_x >= wicones->entry[i].case_pos.x1 && mouse.g_x <= wicones->entry[i].case_pos.x2 && mouse.g_y >= wicones->entry[i].case_pos.y1 && mouse.g_y <= wicones->entry[i].case_pos.y2))
|
||||
{
|
||||
in_icn = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(( evnt.mkstate & ( K_LSHIFT|K_RSHIFT)))
|
||||
{
|
||||
if( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
|
||||
/* If no icon or text icon are selected, we return */
|
||||
if( in_icn || in_txt)
|
||||
{
|
||||
if( !check_selected_entry( wicones, &wicones->entry[i]))
|
||||
add_selected_entry( wicones, &wicones->entry[i]);
|
||||
else
|
||||
remove_selected_entry( wicones, &wicones->entry[i]);
|
||||
|
||||
redraw_icon( win, &wicones->entry[i]);
|
||||
}
|
||||
}
|
||||
else if( in_icn)
|
||||
{
|
||||
if( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
|
||||
if( wicones->first_selected)
|
||||
{
|
||||
while( wicones->first_selected->next_selected)
|
||||
{
|
||||
entry_ptr = wicones->first_selected->next_selected;
|
||||
remove_selected_entry( wicones, wicones->first_selected->next_selected);
|
||||
redraw_icon( win, entry_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
wicones->first_selected = &wicones->entry[i];
|
||||
|
||||
if( old_selected != wicones->first_selected)
|
||||
{
|
||||
if( old_selected)
|
||||
redraw_icon( win, old_selected);
|
||||
|
||||
redraw_icon( win, wicones->first_selected);
|
||||
}
|
||||
/*
|
||||
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
|
||||
|
||||
if (( evnt.mbut == 1) && ( ( evnt.mx != old_x) || ( evnt.my != old_y)))
|
||||
move_icon( win, wicones);
|
||||
*/
|
||||
|
||||
if ( nb_click == 2 && evnt.mbut == 1)
|
||||
{
|
||||
if ( wicones->first_selected->type == ET_DIR)
|
||||
{
|
||||
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
|
||||
|
||||
wicones->mini_selected = NULL;
|
||||
|
||||
if ( old_selected_mini_entry && browser_frame_width)
|
||||
redraw_mini_entry( win, old_selected_mini_entry);
|
||||
|
||||
strcat( wicones->directory, wicones->entry[i].name);
|
||||
( void)scan_dir( win, wicones->directory);
|
||||
|
||||
WindSetStr ( win, WF_NAME, wicones->directory);
|
||||
wicones->first_selected = NULL;
|
||||
win->ypos = 0;
|
||||
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
}
|
||||
else if ( ( wicones->first_selected->type == ET_IMAGE && wicones->first_selected->preview.page) || wicones->first_selected->type == ET_PDF)
|
||||
{
|
||||
strcpy( fullname, wicones->directory);
|
||||
strcat( fullname, wicones->first_selected->name);
|
||||
WindView( fullname);
|
||||
|
||||
// WindView( wicones->first_selected->name);
|
||||
}
|
||||
}
|
||||
else if( evnt.mbut == 2)
|
||||
{
|
||||
WinCatalog_Popup( win, wicones);
|
||||
}
|
||||
}
|
||||
else if( in_txt)
|
||||
{
|
||||
if( wicones->first_selected)
|
||||
{
|
||||
while( wicones->first_selected->next_selected)
|
||||
{
|
||||
entry_ptr = wicones->first_selected->next_selected;
|
||||
remove_selected_entry( wicones, wicones->first_selected->next_selected);
|
||||
redraw_icon( win, entry_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
wicones->first_selected = &wicones->entry[i];
|
||||
|
||||
if( old_selected != wicones->first_selected)
|
||||
{
|
||||
if( old_selected)
|
||||
{
|
||||
if( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
else
|
||||
redraw_icon( win, old_selected);
|
||||
}
|
||||
|
||||
redraw_icon( win, wicones->first_selected);
|
||||
}
|
||||
else if( !wicones->edit)
|
||||
init_edit_mode( win, wicones->first_selected);
|
||||
}
|
||||
else if ( in_frame_border && evnt.mbut == 1)
|
||||
{
|
||||
int16 last_mouse_x;
|
||||
|
||||
if ( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
|
||||
graf_mouse( FLAT_HAND, NULL);
|
||||
|
||||
while( !wind_update( BEG_MCTRL));
|
||||
|
||||
graf_dragbox( border_size, h, x + browser_frame_width, y, x + 100, y, w - ( 100 + win -> w_u), h, &last_mouse_x, &dum );
|
||||
|
||||
/* Set the new toolbar position */
|
||||
if ( last_mouse_x != x + browser_frame_width)
|
||||
{
|
||||
int16 ww;
|
||||
|
||||
if ( last_mouse_x < x + 100)
|
||||
browser_frame_width = 100;
|
||||
else if ( last_mouse_x > x + ( w - win -> w_u))
|
||||
browser_frame_width = w - win -> w_u;
|
||||
else
|
||||
browser_frame_width = last_mouse_x - x;
|
||||
|
||||
/* Set new minimum value */
|
||||
WindCalc( WC_BORDER, win, 0, 0, wicones->case_w + border_size + browser_frame_width, wicones->case_h, &dum, &dum, &ww, &dum);
|
||||
win -> w_min = ww;
|
||||
|
||||
/* ensure that the ypos is inferior that it maximum size */
|
||||
WinCatalog_Refresh( win);
|
||||
|
||||
i = 0;
|
||||
|
||||
while ( i < win -> ypos_max - h / win -> h_u)
|
||||
i ++;
|
||||
|
||||
if( win -> ypos > i)
|
||||
win -> ypos = i;
|
||||
|
||||
EvntRedraw( win);
|
||||
WindMakePreview( win);
|
||||
}
|
||||
|
||||
wind_update( END_MCTRL);
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
}
|
||||
else if ( in_browser)
|
||||
{
|
||||
if ( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
|
||||
if( need_frame_slider && ( mouse.g_x > browser_frame_width - 15) && ( mouse.g_x < browser_frame_width))
|
||||
{
|
||||
int16 res;
|
||||
|
||||
frame_slider_root->ob_x = x + browser_frame_width - 15;
|
||||
frame_slider_root->ob_y = y + 2;
|
||||
|
||||
res = objc_find( frame_slider_root, SLIDERS_BOX, 2, evnt.mx, evnt.my);
|
||||
|
||||
if( res != -1)
|
||||
{
|
||||
int32 pos, old_ypos = wicones->ypos;
|
||||
int16 dy, selected_object, page, redraw_arrow_slider = 0;
|
||||
|
||||
switch ( res)
|
||||
{
|
||||
case SLIDERS_UP:
|
||||
if( wicones -> ypos > 0L)
|
||||
ObjcWindChange( win, frame_slider_root, SLIDERS_UP, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root[SLIDERS_UP].ob_width + 1, frame_slider_root[SLIDERS_UP].ob_height + 1, SELECTED);
|
||||
|
||||
do
|
||||
{
|
||||
if ( wicones -> ypos > 0L)
|
||||
{
|
||||
wicones -> ypos--;
|
||||
move_frame_work( win, -wicones->h_u);
|
||||
redraw_arrow_slider = 1;
|
||||
}
|
||||
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
|
||||
} while( res);
|
||||
|
||||
if( redraw_arrow_slider)
|
||||
{
|
||||
/* We don't call ObjcWindChange to change the up arrow state because it seem not work with userdraw object
|
||||
ObjcWindChange( win, frame_slider_root, SLIDERS_UP, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root->ob_width, frame_slider_root->ob_height, ~SELECTED); */
|
||||
frame_slider_root[SLIDERS_UP].ob_state &= ~SELECTED;
|
||||
ObjcWindDraw( win, frame_slider_root, SLIDERS_UP, 1, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root[SLIDERS_UP].ob_width + 1, frame_slider_root[SLIDERS_UP].ob_height + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIDERS_DOWN:
|
||||
do
|
||||
{
|
||||
if (( wicones -> ypos < wicones -> ypos_max - h / wicones -> h_u) && ( wicones -> ypos_max > h / wicones -> h_u ))
|
||||
{
|
||||
if( redraw_arrow_slider == 0)
|
||||
ObjcWindChange( win, frame_slider_root, SLIDERS_DOWN, frame_slider_root->ob_x, frame_slider_root[SLIDERS_DOWN].ob_y + y, frame_slider_root[SLIDERS_DOWN].ob_width + 1, frame_slider_root[SLIDERS_DOWN].ob_height + 1, SELECTED);
|
||||
|
||||
wicones -> ypos++;
|
||||
move_frame_work( win, wicones->h_u);
|
||||
redraw_arrow_slider = 1;
|
||||
}
|
||||
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
|
||||
} while( res);
|
||||
|
||||
if( redraw_arrow_slider)
|
||||
{
|
||||
/* We don't call ObjcWindChange to change the up arrow state because it seem not work with userdraw object */
|
||||
frame_slider_root[SLIDERS_DOWN].ob_state &= ~SELECTED;
|
||||
ObjcWindDraw( win, frame_slider_root, SLIDERS_DOWN, 1, frame_slider_root->ob_x, frame_slider_root[SLIDERS_DOWN].ob_y + y, frame_slider_root[SLIDERS_DOWN].ob_width + 1, frame_slider_root[SLIDERS_DOWN].ob_height + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIDERS_MOVER:
|
||||
if( app.aes4 & AES4_XGMOUSE)
|
||||
graf_mouse( M_SAVE, 0L);
|
||||
|
||||
graf_mouse( FLAT_HAND, NULL);
|
||||
|
||||
while( !wind_update( BEG_MCTRL));
|
||||
|
||||
res = graf_slidebox( frame_slider_root, SLIDERS_BACK, SLIDERS_MOVER, 1);
|
||||
|
||||
wind_update( END_MCTRL);
|
||||
|
||||
pos = ( int32)( wicones->ypos_max - h / wicones->h_u) * res / 1000L;
|
||||
|
||||
if ( pos < 0)
|
||||
pos = 0;
|
||||
|
||||
dy = ( int16)(( pos - wicones->ypos) * wicones->h_u);
|
||||
|
||||
wicones->ypos = pos;
|
||||
|
||||
if( dy && ( old_ypos != wicones->ypos))
|
||||
move_frame_work( win, dy);
|
||||
|
||||
if( app.aes4 & AES4_XGMOUSE)
|
||||
graf_mouse( M_RESTORE, 0L);
|
||||
|
||||
graf_mouse( ARROW,NULL);
|
||||
|
||||
break;
|
||||
|
||||
case SLIDERS_BACK:
|
||||
objc_offset( frame_slider_root, SLIDERS_MOVER, &dum, &dy);
|
||||
|
||||
dum = ( evnt.my < dy) ? WA_UPPAGE : WA_DNPAGE;
|
||||
selected_object = ( evnt.my < dy) ? SLIDERS_UP : SLIDERS_DOWN;
|
||||
|
||||
while( !wind_update( BEG_MCTRL));
|
||||
|
||||
frame_slider_root[selected_object].ob_state |= SELECTED;
|
||||
|
||||
if( dum == WA_DNPAGE)
|
||||
{
|
||||
do
|
||||
{
|
||||
page = h / wicones -> h_u;
|
||||
|
||||
if ( wicones -> ypos < wicones -> ypos_max - page)
|
||||
{
|
||||
wicones -> ypos = MIN( wicones->ypos_max, wicones->ypos) + page;
|
||||
wicones -> ypos = MIN( wicones -> ypos, wicones -> ypos_max - page);
|
||||
dy = ( int16) (( wicones->ypos - old_ypos) * wicones->h_u);
|
||||
move_frame_work( win, dy);
|
||||
}
|
||||
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
} while( res);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( wicones -> ypos > 0L)
|
||||
{
|
||||
pos = MAX( 0L, wicones->ypos - h / wicones->h_u);
|
||||
dy = ( int16) (( pos - wicones->ypos) * wicones->h_u);
|
||||
wicones->ypos = pos;
|
||||
move_frame_work( win, dy);
|
||||
}
|
||||
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
} while( res);
|
||||
}
|
||||
|
||||
frame_slider_root[selected_object].ob_state &= ~SELECTED;
|
||||
|
||||
ObjcWindDraw( win, frame_slider_root, selected_object, 1, x, y, w, h);
|
||||
|
||||
wind_update( END_MCTRL);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < wicones->nbr_child; i++)
|
||||
{
|
||||
if ( wicones->root[i].nbr_child > 0)
|
||||
if ( find_mini_entry_child_on_mouse( win, &wicones->root[i], mouse.g_x, mouse.g_y))
|
||||
break;
|
||||
|
||||
if (( mouse.g_x >= wicones->root[i].icon_position.x1 && mouse.g_x <= wicones->root[i].icon_position.x2 && mouse.g_y >= wicones->root[i].icon_position.y1 && mouse.g_y <= wicones->root[i].icon_position.y2))
|
||||
{
|
||||
if ( wicones->mini_selected != &wicones->root[i])
|
||||
{
|
||||
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
|
||||
wicones->mini_selected = &wicones->root[i];
|
||||
|
||||
if ( old_selected_mini_entry)
|
||||
redraw_mini_entry( win, old_selected_mini_entry);
|
||||
|
||||
redraw_mini_entry( win, wicones->mini_selected);
|
||||
|
||||
if ( strcmp ( wicones->mini_selected->foldername, wicones->directory) != 0)
|
||||
{
|
||||
while ( wicones->first_selected)
|
||||
remove_selected_entry( wicones, wicones->first_selected);
|
||||
|
||||
graf_mouse( BUSYBEE, NULL);
|
||||
|
||||
( void)scan_dir( win, wicones->mini_selected->foldername);
|
||||
WindSetStr ( win, WF_NAME, wicones->directory);
|
||||
wicones->first_selected = NULL;
|
||||
win->ypos = 0;
|
||||
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if ( wicones->root[i].state != UNKNOWN)
|
||||
{
|
||||
if (( mouse.g_x >= wicones->root[i].arrow_position.x1 && mouse.g_x <= wicones->root[i].arrow_position.x2 && mouse.g_y >= wicones->root[i].arrow_position.y1 && mouse.g_y <= wicones->root[i].arrow_position.y2))
|
||||
{
|
||||
if ( wicones->root[i].state == ON)
|
||||
{
|
||||
wicones->root[i].state = OFF;
|
||||
delete_mini_entry_child( &wicones->root[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mini_Entry *selected = &wicones->root[i];
|
||||
|
||||
graf_mouse( BUSYBEE, NULL);
|
||||
|
||||
selected->state = ON;
|
||||
scan_mini_dir( win, selected);
|
||||
check_mini_dir( selected->nbr_child, selected->child);
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
}
|
||||
|
||||
WinCatalog_Refresh( win);
|
||||
|
||||
draw_page( win, x, y , browser_frame_width, h);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !in_txt && !in_icn && !in_browser && !in_frame_border)
|
||||
{
|
||||
if ( wicones->edit)
|
||||
exit_edit_mode( win, old_selected);
|
||||
|
||||
while( wicones->first_selected)
|
||||
{
|
||||
entry_ptr = wicones->first_selected;
|
||||
remove_selected_entry( wicones, wicones->first_selected);
|
||||
redraw_icon( win, entry_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if( !( wicones->first_selected))
|
||||
{
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
|
||||
|
||||
if( old_entry)
|
||||
{
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
|
||||
|
||||
if( old_type == ET_IMAGE)
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wicones->first_selected->type == ET_IMAGE)
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 1);
|
||||
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 1);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 1);
|
||||
|
||||
if( !old_entry)
|
||||
{
|
||||
if( wicones->first_selected->type == ET_IMAGE)
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
|
||||
}
|
||||
else if(( wicones->first_selected->type != old_type) && ( wicones->first_selected->type == ET_IMAGE || old_type == ET_IMAGE))
|
||||
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
|
||||
}
|
||||
|
||||
/* a wait loop while the mouse button is pressed */
|
||||
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
|
||||
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
|
||||
}
|
||||
2
sources/z-tools/trunk/zview/catalog/catalog_mouse.h
Normal file
2
sources/z-tools/trunk/zview/catalog/catalog_mouse.h
Normal file
@@ -0,0 +1,2 @@
|
||||
extern void WinCatalog_Mouse( WINDOW *win) ;
|
||||
|
||||
103
sources/z-tools/trunk/zview/catalog/catalog_other_event.c
Normal file
103
sources/z-tools/trunk/zview/catalog/catalog_other_event.c
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "../general.h"
|
||||
#include "catalog.h"
|
||||
#include "../prefs.h"
|
||||
|
||||
/* Prototype */
|
||||
void WinCatalog_Fulled( WINDOW *win);
|
||||
void WinCatalog_top( WINDOW *win);
|
||||
void WinCatalog_bottom( WINDOW *win);
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Fulled: *
|
||||
* this function handle the WM_FULLED event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Fulled( WINDOW *win)
|
||||
{
|
||||
int16 x, y, w, h;
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
|
||||
if( win->status & WS_FULLSIZE)
|
||||
{
|
||||
wind_get( evnt.buff[3], WF_PREVXYWH, &x, &y, &w, &h);
|
||||
wind_set( evnt.buff[3], WF_CURRXYWH, x, y, w, h);
|
||||
} else
|
||||
wind_set( evnt.buff[3], WF_CURRXYWH, app.x, app.y, win->w_max, win->h_max);
|
||||
|
||||
win->status ^= WS_FULLSIZE;
|
||||
|
||||
win -> ypos = 0;
|
||||
wicones -> ypos = 0;
|
||||
|
||||
WindSlider( win, VSLIDER);
|
||||
|
||||
WindGet ( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
|
||||
WindMakePreview( win);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_top: *
|
||||
* this function handle the WM_TOPPED event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_top( WINDOW *win)
|
||||
{
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
OBJECT *menu = get_tree( MENU_BAR);
|
||||
|
||||
if( !wicones->first_selected)
|
||||
{
|
||||
menu_ienable( menu, MENU_BAR_INFORMATION, 0);
|
||||
menu_ienable( menu, MENU_BAR_SAVE, 0);
|
||||
menu_ienable( menu, MENU_BAR_DELETE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wicones->first_selected->type == ET_IMAGE)
|
||||
menu_ienable( menu, MENU_BAR_SAVE, 1);
|
||||
|
||||
menu_ienable( menu, MENU_BAR_DELETE, 1);
|
||||
menu_ienable( menu, MENU_BAR_INFORMATION, 1);
|
||||
}
|
||||
|
||||
menu_ienable( menu, MENU_BAR_SHOW_FULLSCREEN, 0);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_bottom: *
|
||||
* this function handle the WM_BOTTOMED event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_bottom( WINDOW *win)
|
||||
{
|
||||
win = win; // for prevent compiler warning
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
|
||||
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
extern void WinCatalog_Fulled( WINDOW *win);
|
||||
extern void WinCatalog_top( WINDOW *win);
|
||||
extern void WinCatalog_bottom( WINDOW *win);
|
||||
|
||||
|
||||
23
sources/z-tools/trunk/zview/catalog/catalog_popup.c
Normal file
23
sources/z-tools/trunk/zview/catalog/catalog_popup.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../general.h"
|
||||
#include "../ztext.h"
|
||||
#include "../mfdb.h"
|
||||
#include "catalog_entry.h"
|
||||
#include "../plugins.h"
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Popup: *
|
||||
* . *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Popup( WINDOW *win, WINDICON *wicones)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
1
sources/z-tools/trunk/zview/catalog/catalog_popup.h
Normal file
1
sources/z-tools/trunk/zview/catalog/catalog_popup.h
Normal file
@@ -0,0 +1 @@
|
||||
extern void WinCatalog_Popup( WINDOW *win, WINDICON *wicones);
|
||||
108
sources/z-tools/trunk/zview/catalog/catalog_size.c
Normal file
108
sources/z-tools/trunk/zview/catalog/catalog_size.c
Normal file
@@ -0,0 +1,108 @@
|
||||
#include "../general.h"
|
||||
#include "../prefs.h"
|
||||
#include "catalog_mini_entry.h"
|
||||
#include "catalog.h"
|
||||
|
||||
/* Prototype */
|
||||
void WinCatalog_Size( WINDOW *win);
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Size: *
|
||||
* this function handle the WM_SIZED event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Size( WINDOW *win)
|
||||
{
|
||||
int16 dum, x, y, w, h, old_h, rdw_win = 0, rdw_frame = 0;
|
||||
uint32 old_win_ypos, old_frame_ypos;
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
|
||||
x = MAX( evnt.buff[6], win -> w_min);
|
||||
y = MAX( evnt.buff[7], win -> h_min);
|
||||
|
||||
w = MIN( x, win -> w_max);
|
||||
h = MIN( y, win -> h_max);
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &dum, &dum, &dum, &old_h);
|
||||
|
||||
wind_set( evnt.buff[3], WF_CURRXYWH, evnt.buff[4], evnt.buff[5], w, h);
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
old_win_ypos = win -> ypos;
|
||||
old_frame_ypos = wicones -> ypos;
|
||||
|
||||
if( ( uint16)h > wicones -> ypos_max * wicones -> h_u)
|
||||
wicones -> ypos = 0;
|
||||
else
|
||||
wicones -> ypos = MIN( wicones -> ypos, wicones -> ypos_max - h / wicones -> h_u);
|
||||
|
||||
if( ( uint16)h > win -> ypos_max * win -> h_u)
|
||||
win -> ypos = 0;
|
||||
else
|
||||
win -> ypos = MIN( win -> ypos, win -> ypos_max - h / win -> h_u);
|
||||
|
||||
if( old_frame_ypos != wicones -> ypos)
|
||||
{
|
||||
rdw_frame = 1;
|
||||
}
|
||||
|
||||
if( old_win_ypos != win -> ypos)
|
||||
{
|
||||
rdw_win = 1;
|
||||
}
|
||||
else if ( w >= (( wicones->columns + 1) * wicones->case_w + border_size + browser_frame_width) || w < wicones->columns * wicones->case_w + border_size + browser_frame_width)
|
||||
{
|
||||
if ( w < (( wicones->nbr_icons + 1) * wicones->case_w + border_size + browser_frame_width))
|
||||
rdw_win = 1;
|
||||
}
|
||||
|
||||
win->status &= ~WS_FULLSIZE;
|
||||
|
||||
if( rdw_win)
|
||||
{
|
||||
draw_page( win, x + browser_frame_width + border_size , y + 1, w - ( browser_frame_width + border_size), h - 1);
|
||||
|
||||
WindMakePreview( win);
|
||||
}
|
||||
else if( ( old_h != h) && browser_frame_width)
|
||||
{
|
||||
if( rdw_frame)
|
||||
draw_page( win, x, y + 1, browser_frame_width, h - 1);
|
||||
else if( ( wicones -> ypos_max * wicones -> h_u) >= h)
|
||||
{
|
||||
need_frame_slider = 1;
|
||||
frame_slider_root->ob_x = x + browser_frame_width - 15;
|
||||
frame_slider_root->ob_y = y + 2;
|
||||
frame_slider_root->ob_height = h - 3;
|
||||
|
||||
frame_slider_root[SLIDERS_BACK].ob_height = h - 31;
|
||||
|
||||
frame_slider_root[SLIDERS_UP].ob_y = frame_slider_root->ob_height - 31;
|
||||
frame_slider_root[SLIDERS_DOWN].ob_y = frame_slider_root->ob_height - 15;
|
||||
|
||||
calc_mini_entry_slider( wicones, frame_slider_root);
|
||||
|
||||
/* check it in the windom source, I'm not sure if the clipping area must be clip.g_x, clip.g_y, clip.g_w, clip.g_h or not */
|
||||
ObjcWindDraw( win, frame_slider_root, SLIDERS_BOX, 2, x + browser_frame_width - 15, y, 16, h);
|
||||
|
||||
WindSlider( win, VSLIDER);
|
||||
}
|
||||
else /* if( need_frame_slider) */
|
||||
{
|
||||
need_frame_slider = 0;
|
||||
draw_page( win, x + browser_frame_width - 16 , y + 1, 16, h - 1);
|
||||
}
|
||||
}
|
||||
else if( old_h != h)
|
||||
{
|
||||
WindSlider( win, VSLIDER);
|
||||
}
|
||||
}
|
||||
2
sources/z-tools/trunk/zview/catalog/catalog_size.h
Normal file
2
sources/z-tools/trunk/zview/catalog/catalog_size.h
Normal file
@@ -0,0 +1,2 @@
|
||||
extern void WinCatalog_Size( WINDOW *win);
|
||||
|
||||
463
sources/z-tools/trunk/zview/catalog/catalog_slider.c
Normal file
463
sources/z-tools/trunk/zview/catalog/catalog_slider.c
Normal file
@@ -0,0 +1,463 @@
|
||||
#include "../general.h"
|
||||
#include "../prefs.h"
|
||||
#include "catalog_mini_entry.h"
|
||||
#include "catalog.h"
|
||||
|
||||
|
||||
/* prototype */
|
||||
void WinCatalog_Arrow( WINDOW *win);
|
||||
void WinCatalog_VSlide( WINDOW *win);
|
||||
void WinCatalog_DownLine( WINDOW *win);
|
||||
void WinCatalog_UpLine( WINDOW *win);
|
||||
void WinCatalog_DownPage( WINDOW *win);
|
||||
void WinCatalog_UpPage( WINDOW *win);
|
||||
void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy);
|
||||
void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width);
|
||||
void move_frame_work( WINDOW *win, int16 dy);
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void move_area: *
|
||||
* utility function for the move_*_work functions. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* handle -> The vdi handle. *
|
||||
* screen -> The area coordinate to move. *
|
||||
* dy -> The step for the move. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy)
|
||||
{
|
||||
int16 xy[8];
|
||||
MFDB screen_mfdb = {0};
|
||||
GRECT g;
|
||||
|
||||
wind_get( 0, WF_CURRXYWH, &g.g_x, &g.g_y, &g.g_w, &g.g_h);
|
||||
|
||||
rc_intersect( &g, screen);
|
||||
|
||||
xy[0] = screen -> g_x;
|
||||
xy[1] = screen -> g_y;
|
||||
xy[2] = xy[0] + screen -> g_w - 1;
|
||||
xy[3] = xy[1] + screen -> g_h - 1;
|
||||
xy[4] = xy[0] + dx;
|
||||
xy[5] = xy[1] + dy;
|
||||
xy[6] = xy[2] + dx;
|
||||
xy[7] = xy[3] + dy;
|
||||
|
||||
vro_cpyfm( handle, S_ONLY, xy, &screen_mfdb, &screen_mfdb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void move_work: *
|
||||
* this function moves the main frame ( entries) work area of the window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
* dy -> The step for the move. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width)
|
||||
{
|
||||
int16 x = xw, y = yw + 1, w = ww, h = hw - 1, absolute_dy, absolute_dx;
|
||||
GRECT rect, r1, r2, screen;
|
||||
|
||||
absolute_dy = abs( dy);
|
||||
absolute_dx = abs( dx);
|
||||
|
||||
if ( dx || dy)
|
||||
{
|
||||
x += ( first_frame_width + border_width);
|
||||
w -= ( first_frame_width + border_width);
|
||||
|
||||
while( !wind_update(BEG_UPDATE));
|
||||
graf_mouse( M_OFF, 0L);
|
||||
rc_set( &rect, x, y, w, h);
|
||||
|
||||
wind_get_grect( 0, WF_CURRXYWH, &screen);
|
||||
wind_get( win -> handle, WF_FIRSTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
|
||||
|
||||
while ( r1.g_w && r1.g_h)
|
||||
{
|
||||
if( rc_intersect( &rect, &r1) && rc_intersect( &screen, &r1))
|
||||
{
|
||||
if ( ( absolute_dx < r1.g_w) && ( absolute_dy < r1.g_h))
|
||||
{
|
||||
r2 = r1; /* save */
|
||||
|
||||
if ( dy > 0)
|
||||
{
|
||||
r1.g_y += dy;
|
||||
r1.g_h -= dy;
|
||||
}
|
||||
else
|
||||
r1.g_h += dy;
|
||||
|
||||
if (dx > 0)
|
||||
{
|
||||
r1.g_x += dx;
|
||||
r1.g_w -= dx;
|
||||
}
|
||||
else
|
||||
r1.g_w += dx;
|
||||
|
||||
move_area( win->graf.handle, &r1, -dx, -dy);
|
||||
|
||||
if (dx)
|
||||
{
|
||||
r1 = r2 ; /* restore */
|
||||
|
||||
if (dx > 0)
|
||||
{
|
||||
r1.g_x += r1.g_w - dx;
|
||||
r1.g_w = dx;
|
||||
}
|
||||
else
|
||||
r1.g_w = - dx;
|
||||
|
||||
if (dy > 0)
|
||||
r1.g_h -= dy;
|
||||
else
|
||||
{
|
||||
r1.g_y -= dy;
|
||||
r1.g_h += dy;
|
||||
}
|
||||
rc_clip_on( win->graf.handle, &r1);
|
||||
EvntExec( win, WM_REDRAW);
|
||||
rc_clip_off( win->graf.handle);
|
||||
}
|
||||
|
||||
if ( dy)
|
||||
{
|
||||
r1 = r2 ; /* restore */
|
||||
|
||||
if (dy > 0)
|
||||
{
|
||||
r1.g_y += r1.g_h - dy;
|
||||
r1.g_h = dy;
|
||||
}
|
||||
else
|
||||
r1.g_h = -dy;
|
||||
|
||||
rc_clip_on( win->graf.handle, &r1);
|
||||
EvntExec( win, WM_REDRAW);
|
||||
rc_clip_off( win->graf.handle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc_clip_on( win->graf.handle, &r1);
|
||||
EvntExec( win, WM_REDRAW);
|
||||
rc_clip_off( win->graf.handle);
|
||||
}
|
||||
}
|
||||
wind_get( win->handle, WF_NEXTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
|
||||
}
|
||||
graf_mouse( M_ON, 0L);
|
||||
wind_update(END_UPDATE);
|
||||
|
||||
if ( dy)
|
||||
WindSlider( win, VSLIDER);
|
||||
if ( dx)
|
||||
WindSlider( win, HSLIDER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void move_frame_work: *
|
||||
* this function moves the mini_entry frame work area of the window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
* dy -> The step fo the move. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void move_frame_work( WINDOW *win, int16 dy)
|
||||
{
|
||||
int16 x, y, w, h, absolute_dy;
|
||||
GRECT rect, r1, r2, screen;
|
||||
|
||||
absolute_dy = abs( dy);
|
||||
|
||||
if ( dy)
|
||||
{
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
y++;
|
||||
h--;
|
||||
w = browser_frame_width - 16;
|
||||
|
||||
while( !wind_update(BEG_UPDATE));
|
||||
graf_mouse( M_OFF, 0L);
|
||||
rc_set( &rect, x + 1, y, w, h);
|
||||
wind_get_grect( 0, WF_CURRXYWH, &screen);
|
||||
wind_get( win -> handle, WF_FIRSTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
|
||||
|
||||
while ( r1.g_w && r1.g_h)
|
||||
{
|
||||
if( rc_intersect( &rect, &r1) && rc_intersect( &screen, &r1))
|
||||
{
|
||||
if ( ( absolute_dy < r1.g_h) )
|
||||
{
|
||||
r2 = r1; /* save */
|
||||
|
||||
if ( dy > 0)
|
||||
{
|
||||
r1.g_y += dy;
|
||||
r1.g_h -= dy;
|
||||
}
|
||||
else
|
||||
r1.g_h += dy;
|
||||
|
||||
move_area( win->graf.handle, &r1, 0, -dy);
|
||||
|
||||
if ( dy)
|
||||
{
|
||||
r1 = r2 ; /* restore */
|
||||
|
||||
if (dy > 0)
|
||||
{
|
||||
r1.g_y += r1.g_h - dy;
|
||||
r1.g_h = dy;
|
||||
}
|
||||
else
|
||||
r1.g_h = -dy;
|
||||
|
||||
rc_clip_on( win->graf.handle, &r1);
|
||||
EvntExec( win, WM_REDRAW);
|
||||
rc_clip_off( win->graf.handle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc_clip_on( win->graf.handle, &r1);
|
||||
EvntExec( win, WM_REDRAW);
|
||||
rc_clip_off( win->graf.handle);
|
||||
}
|
||||
}
|
||||
wind_get( win->handle, WF_NEXTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
|
||||
}
|
||||
wind_update(END_UPDATE);
|
||||
graf_mouse( M_ON, 0L);
|
||||
|
||||
if ( dy)
|
||||
{
|
||||
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
|
||||
|
||||
need_frame_slider = 1;
|
||||
calc_mini_entry_slider( wicones, frame_slider_root);
|
||||
|
||||
/* check it in the windom source, I'm not sure if the clipping area must be clip.g_x, clip.g_y, clip.g_w, clip.g_h or not */
|
||||
ObjcWindDraw( win, frame_slider_root, SLIDERS_BACK, 2, x + browser_frame_width - 15, y, 16, h - 31);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_VSlide: *
|
||||
* this function handle the WM_VSLID event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_VSlide( WINDOW *win)
|
||||
{
|
||||
int32 pos;
|
||||
int16 x, y, w, h, dy;
|
||||
int16 old_ypos = win->ypos;
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
pos = ( int32)( win->ypos_max - h / win->h_u) * ( int32)evnt.buff[4] / 1000L;
|
||||
|
||||
if ( pos < 0)
|
||||
pos = 0;
|
||||
|
||||
dy = ( int16)(( pos - win->ypos) * win->h_u);
|
||||
win->ypos = ( int16) pos;
|
||||
|
||||
if( dy && ( old_ypos != win->ypos))
|
||||
{
|
||||
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
|
||||
|
||||
/* we look if image are visible and we create the preview */
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_DownPage: *
|
||||
* this function handle the WM_DNPAGE event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_DownPage( WINDOW *win)
|
||||
{
|
||||
int16 page, x, y, w, h, dy;
|
||||
int32 old_pos = win -> ypos;
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
page = h / win -> h_u;
|
||||
|
||||
if ( win -> ypos < win -> ypos_max - page)
|
||||
{
|
||||
win -> ypos = MIN( win->ypos_max, win->ypos) + page;
|
||||
win -> ypos = MIN( win -> ypos, win -> ypos_max - page);
|
||||
dy = ( int16) (( win->ypos - old_pos) * win->h_u);
|
||||
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
|
||||
|
||||
/* After each 'downpage', we look if image are visible and we create the preview */
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_UpPage: *
|
||||
* this function handle the WM_UPPAGE event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_UpPage( WINDOW *win)
|
||||
{
|
||||
int32 pos;
|
||||
int16 x, y, w, h, dy;
|
||||
|
||||
if ( win -> ypos > 0L)
|
||||
{
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
pos = MAX( 0L, win->ypos - h / win->h_u);
|
||||
dy = ( int16) (( pos - win->ypos) * win->h_u);
|
||||
win->ypos = pos;
|
||||
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
|
||||
|
||||
/* After each 'uppage', we look if image are visible and we create the preview */
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_UpLine: *
|
||||
* this function handle the WM_UPLINE event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_UpLine( WINDOW *win)
|
||||
{
|
||||
if ( win -> ypos > 0L)
|
||||
{
|
||||
int16 x, y, w, h;
|
||||
|
||||
win->ypos --;
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
move_main_work( win, x, y, w, h, 0, -win->h_u, browser_frame_width, border_size);
|
||||
|
||||
/* After each 'upline', we look if image are visible and we create the preview */
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_DownLine: *
|
||||
* this function handle the WM_DNLINE event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_DownLine( WINDOW *win)
|
||||
{
|
||||
int16 x, y, w, h;
|
||||
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
|
||||
|
||||
if (( win -> ypos < win -> ypos_max - h / win -> h_u) && ( win -> ypos_max > h / win -> h_u ))
|
||||
{
|
||||
win -> ypos ++;
|
||||
move_main_work( win, x, y, w, h, 0, win->h_u, browser_frame_width, border_size);
|
||||
|
||||
/* After each 'downpage', we look if image are visible and we create the preview */
|
||||
WindMakePreview( win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void WinCatalog_Arrow: *
|
||||
* this function handle the WM_ARROWED event for the main frame in the *
|
||||
* catalog ( the entries). *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* win -> The target window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
|
||||
void WinCatalog_Arrow( WINDOW *win)
|
||||
{
|
||||
switch( evnt.buff[4])
|
||||
{
|
||||
case WA_UPPAGE:
|
||||
WinCatalog_UpPage( win);
|
||||
break;
|
||||
case WA_DNPAGE:
|
||||
WinCatalog_DownPage( win);
|
||||
break;
|
||||
case WA_UPLINE:
|
||||
WinCatalog_UpLine( win);
|
||||
break;
|
||||
case WA_DNLINE:
|
||||
WinCatalog_DownLine( win);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
11
sources/z-tools/trunk/zview/catalog/catalog_slider.h
Normal file
11
sources/z-tools/trunk/zview/catalog/catalog_slider.h
Normal file
@@ -0,0 +1,11 @@
|
||||
extern void WinCatalog_Arrow( WINDOW *win);
|
||||
extern void WinCatalog_VSlide( WINDOW *win);
|
||||
extern void WinCatalog_DownLine( WINDOW *win);
|
||||
extern void WinCatalog_UpLine( WINDOW *win);
|
||||
extern void WinCatalog_DownPage( WINDOW *win);
|
||||
extern void WinCatalog_UpPage( WINDOW *win);
|
||||
|
||||
extern void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width);
|
||||
extern void move_frame_work( WINDOW *win, int16 dy);
|
||||
extern void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy);
|
||||
|
||||
Reference in New Issue
Block a user