summaryrefslogtreecommitdiff
path: root/atari/treeview.c
diff options
context:
space:
mode:
Diffstat (limited to 'atari/treeview.c')
-rwxr-xr-xatari/treeview.c179
1 files changed, 90 insertions, 89 deletions
diff --git a/atari/treeview.c b/atari/treeview.c
index 729f0bcd4..d5f9957d3 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -61,25 +61,25 @@ static void __CDECL evnt_tv_keybd( WINDOW *win, short buff[8], void * data )
bool r=false;
long kstate = 0;
long kcode = 0;
- long ucs4;
- long ik;
+ long ucs4;
+ long ik;
unsigned short nkc = 0;
unsigned short nks = 0;
unsigned char ascii;
-
- NSTREEVIEW tv = (NSTREEVIEW) data;
+
+ NSTREEVIEW tv = (NSTREEVIEW) data;
kstate = evnt.mkstate;
kcode = evnt.keybd;
- nkc= gem_to_norm( (short)kstate, (short)kcode );
+ nkc= gem_to_norm( (short)kstate, (short)kcode );
ascii = (nkc & 0xFF);
- ik = nkc_to_input_key( nkc, &ucs4 );
-
- if( ik == 0 ){
+ ik = nkc_to_input_key( nkc, &ucs4 );
+
+ if( ik == 0 ){
if (ascii >= 9 ) {
r = tree_keypress( tv->tree, ucs4 );
- }
- } else {
- r = tree_keypress( tv->tree, ik );
+ }
+ } else {
+ r = tree_keypress( tv->tree, ik );
}
}
@@ -104,16 +104,16 @@ static void __CDECL evnt_tv_redraw( WINDOW *win, short buff[8], void * data )
clip.g_y = 0;
}
if( clip.g_h > 0 && clip.g_w > 0 ) {
- atari_treeview_request_redraw(
- win->xpos*win->w_u + clip.g_x,
+ atari_treeview_request_redraw(
+ win->xpos*win->w_u + clip.g_x,
win->ypos*win->h_u + clip.g_y,
- clip.g_w, clip.g_h, tv
+ clip.g_w, clip.g_h, tv
);
}
}
-static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
-{
+static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
+{
GRECT work;
NSTREEVIEW tv = (NSTREEVIEW) data;
if( tv == NULL )
@@ -121,81 +121,81 @@ static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
if( evnt.mbut & 2 ) {
/* do not handle right click */
return;
- }
-
- WindGetGrect( tv->window, WF_WORKXYWH, &work );
-
+ }
+
+ WindGetGrect( tv->window, WF_WORKXYWH, &work );
+
/* mouse click relative origin: */
short origin_rel_x = (evnt.mx-work.g_x)+(win->xpos*win->w_u);
- short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
-
- if( origin_rel_x >= 0 && origin_rel_y >= 0
- && evnt.mx < work.g_x + work.g_w
- && evnt.my < work.g_y + work.g_h )
- {
- int bms;
- bool ignore=false;
- short cur_rel_x, cur_rel_y, dummy, mbut;
-
+ short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
+
+ if( origin_rel_x >= 0 && origin_rel_y >= 0
+ && evnt.mx < work.g_x + work.g_w
+ && evnt.my < work.g_y + work.g_h )
+ {
+ int bms;
+ bool ignore=false;
+ short cur_rel_x, cur_rel_y, dummy, mbut;
+
if( evnt.nb_click == 2 ){
- tree_mouse_action(tv->tree,
- BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
- origin_rel_x, origin_rel_y );
- return;
- }
-
- graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
- if( (mbut&1) == 0 ){
- bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
- if( evnt.nb_click == 2 ) {
- bms = BROWSER_MOUSE_DOUBLE_CLICK;
+ tree_mouse_action(tv->tree,
+ BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
+ origin_rel_x, origin_rel_y );
+ return;
+ }
+
+ graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
+ if( (mbut&1) == 0 ){
+ bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
+ if( evnt.nb_click == 2 ) {
+ bms = BROWSER_MOUSE_DOUBLE_CLICK;
}
- tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
- } else {
- /* button still pressed */
-
- short prev_x = origin_rel_x;
- short prev_y = origin_rel_y;
-
- cur_rel_x = origin_rel_x;
- cur_rel_y = origin_rel_y;
-
- if( tree_is_edited(tv->tree) ){
- gem_set_cursor(&gem_cursors.ibeam);
- } else {
- gem_set_cursor(&gem_cursors.hand);
- }
-
+ tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
+ } else {
+ /* button still pressed */
+
+ short prev_x = origin_rel_x;
+ short prev_y = origin_rel_y;
+
+ cur_rel_x = origin_rel_x;
+ cur_rel_y = origin_rel_y;
+
+ if( tree_is_edited(tv->tree) ){
+ gem_set_cursor(&gem_cursors.ibeam);
+ } else {
+ gem_set_cursor(&gem_cursors.hand);
+ }
+
tv->startdrag.x = origin_rel_x;
- tv->startdrag.y = origin_rel_y;
-
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
- cur_rel_x, cur_rel_y );
- do{
- if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
- cur_rel_x, cur_rel_y);
- prev_x = cur_rel_x;
- prev_y = cur_rel_y;
- }
-
- if( tv->redraw )
- atari_treeview_redraw( tv );
- /* sample mouse button state: */
- graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
+ tv->startdrag.y = origin_rel_y;
+
+ tree_mouse_action( tv->tree,
+ BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
+ cur_rel_x, cur_rel_y );
+ do{
+ if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
+ tree_mouse_action( tv->tree,
+ BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
+ cur_rel_x, cur_rel_y);
+ prev_x = cur_rel_x;
+ prev_y = cur_rel_y;
+ }
+
+ if( tv->redraw )
+ atari_treeview_redraw( tv );
+ /* sample mouse button state: */
+ graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
cur_rel_x = (cur_rel_x-work.g_x)+(win->xpos*win->w_u);
- cur_rel_y = (cur_rel_y-work.g_y)+(win->ypos*win->h_u);
- } while( mbut & 1 );
-
- tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
- cur_rel_x, cur_rel_y );
- gem_set_cursor(&gem_cursors.arrow);
- }
- }
-}
-
+ cur_rel_y = (cur_rel_y-work.g_y)+(win->ypos*win->h_u);
+ } while( mbut & 1 );
+
+ tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
+ cur_rel_x, cur_rel_y );
+ gem_set_cursor(&gem_cursors.arrow);
+ }
+ }
+}
+
NSTREEVIEW atari_treeview_create( uint32_t flags, WINDOW *win )
{
if( win == NULL )
@@ -274,12 +274,13 @@ void atari_treeview_redraw( NSTREEVIEW tv)
struct redraw_context ctx = {
.interactive = true,
+ .background_images = true,
.plot = &atari_plotters
};
plotter->resize(plotter, work.g_w, work.g_h);
- plotter->move(plotter, work.g_x, work.g_y );
- if( plotter->lock( plotter ) == 0 )
+ plotter->move(plotter, work.g_x, work.g_y );
+ if( plotter->lock( plotter ) == 0 )
return;
todo[0] = work.g_x;
@@ -314,10 +315,10 @@ void atari_treeview_redraw( NSTREEVIEW tv)
break;
}
}
- } else {
+ } else {
plotter->unlock( plotter );
return;
- }
+ }
plotter->unlock( plotter );
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
tv->redraw = false;