Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/0703404654d2a40cacae2...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/0703404654d2a40cacae2d9...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/0703404654d2a40cacae2d94c...
The branch, mono/removing-windom-dependency has been updated
via 0703404654d2a40cacae2d94c6e0e22ca28b4acf (commit)
via 54f719aa960159c5b1978846223732c9669ca7fa (commit)
via 89856f55929907642013e45435b9d18cd1fafe36 (commit)
via 663191791eda7034c3d7d99a4039eca8ba02b441 (commit)
via e30e6ec8e9bd435e76261528f055d0b3a6312426 (commit)
via 5eb417fff49348f4421de8e2d5f773ae029a4c28 (commit)
via af7a5d2d67a2eb42e67a1775ba4a83d9b5ce6939 (commit)
via 385d9170d993f67c40b9ec2b69dab45e7bd96027 (commit)
via 93cc123200f1e4856ad5b5c608d8deeb34522053 (commit)
via 75a24f7838896910db7d0fa549d6101d9ad65719 (commit)
via 7710214ec2306f2faa7fa2300b4972f5f0151127 (commit)
via a30d51cb50f130bc91c7ee13b6656f1e64c94215 (commit)
via 23e16e020e40807d1e7e099d06af9b56cb426149 (commit)
via 30dfa090085f9b0b21ea5181795e9f6930292897 (commit)
via 12890d3c60fdfde9c3f18af411a762ff1e0e27c2 (commit)
via f058e9881764888dc78b4ac32a6dca107bb9b17b (commit)
via 18091ec1a9ab94db511ff0c01e590e1a8aa533f9 (commit)
via db71ffc8eae9a857e92310f5aba665adb058ff4c (commit)
via 67ffb8e6e97a5572f1033a7326f8ecc232b17201 (commit)
via 09dc0649df1b0dd97e4c13aef3c41870eeff5572 (commit)
via 7ab835df8f45fcea7f12eafe422021b8232b5dd8 (commit)
via 16d938dd63b1003daafcbead03779eb587dc823d (commit)
via db7d3acdc3b7256728bf5dcfce8ef04a8d32b65b (commit)
via 1d0835098134a68add69146c822cc079da374f30 (commit)
via fab7b04de689fdbb03e4cf604b1524a80bb4a174 (commit)
via 31f7af700f64070bb5826fd86f6d2af19589669d (commit)
via faddd8b0350e3c55555437d19e0148b30bd018ad (commit)
via 9b568abf96defa0194f4fcb6e68d008c6e28423e (commit)
via 577ff3cffc5fb99041c5da2d828b1f25cfb13dc9 (commit)
via fc6f04161e614521cff67f7bbaf70dbea0332f4d (commit)
via 053976eb0fa4c7322c4a4448a2706bd96d1a1930 (commit)
via 64ae9e8693aaaf09cb4e35b63d029d446ef361b0 (commit)
via 985e4ce6be424aec5e797d92c09e0ee22cde7874 (commit)
via 2e91d4e17eea238281451532437e7447bfd4f0bf (commit)
via def45f8e55c7cc88c292a7194454efc73a46b974 (commit)
via 87946c5de8eae4fdcff8155f59d2a01c3784b7c8 (commit)
via 2f94b0a949eeceb61a9a06d4d825e54e6fa3f254 (commit)
via 088cbf5499ff17c9a1d57b443d6ed5e1595ad726 (commit)
via e547026dfa78c3a50818dabfc3be98af31c7735e (commit)
via 9995ef583f0820013e4e870f572b794bd46b4b13 (commit)
via bba7aeca14388330e3a423921ad1e2863cc1e31e (commit)
via bf7b23506da89669fadfe6628a8aba5fcd36d55a (commit)
via a6e56546c957f213503333483b383307dda144b9 (commit)
via f16229552a06e64df579a1133c5efe571e401748 (commit)
via c4e8651b27d2e1ea508164ea432d43286bd67924 (commit)
via 5f66864c3a4d1b60abf6c2888d11b41edc8d869d (commit)
via 7b62bb5ff89b08820f56df666c8d9616c8c57489 (commit)
via 3f1c2a831536cb4b89db52162460f25ecaf9d4c8 (commit)
via 5bda4edb1a0d42c4ab3072d3c83526dadd6c0124 (commit)
via d899ebb5fa8c2692ddd1de9c91dce7863e0089f1 (commit)
via d25289695360d16c25e39a022e949c6f56245adc (commit)
via 7a0b3475634642194b256ef3c4a294c72e312a18 (commit)
via 0f08d885a048ddfc1a6fe52b88ba410f52d5dbe9 (commit)
via 348e9789a42ce5479dcd38057d9d9d37fedaff6f (commit)
via 78e956607f2ca6c592c5f76865441cab57da7860 (commit)
via 4e756f6088bce4cd634702d02ccdae5389392a17 (commit)
via 96264ca71ebddece12360c742ce4215011e5b282 (commit)
via 700aea8b08c565926e35d1816ad8a1db36f1462c (commit)
via 2b7bc02961a3fa251f58618b73527968cecda8ef (commit)
via a6b117fcb43b8afea584ff2e6ec3e808f27f8d9f (commit)
via 6975360e1c3aeeb8607857c5f9c11158a12b76ea (commit)
via 8625933812a3d33261bf67cb82aad7f8075599db (commit)
via e7ef916b53510f643736e6b21cd27e896886f5bc (commit)
via a2e67922d5702c9691a688abf622cf8afdc6fd9c (commit)
via 4e7edf00e217bc05ab6c0b45bcf9e9d843f99f32 (commit)
via 6e09ff691bbba9aa5bd68e0f1d9f66a709149599 (commit)
via 8e66adaade55a6ca82a6e8a97e52312adafe38ce (commit)
via 716b50062b7d700d0048809c0433468a3a892f93 (commit)
via 740559ab52c0f7cf4123eddd4a1d96196843a8cb (commit)
via 6938efc2a051ea5b8fc97b94898d417b7ea2dcba (commit)
via c7a37392e49deb5007dc3679e0aa7e65b4ff0c8b (commit)
via a6b08c674f3d2fdd91fa6419076e756b07c6630c (commit)
via 5124b8a02a2adb72a7352f14e06dc2a773afbc1f (commit)
via 453301f96153a72f71884916967503d29a55aaa6 (commit)
via 261528747c5423445398b5ee5ab6bc9c26b0d93b (commit)
via ac03806a50f292fc13930a2fdb3c8744bcaa954a (commit)
via ac89e5210918839b5d29cc0f030a79636b900e76 (commit)
via d7ddfd6ac3aff83498a10dc5fbe7ac792c533ebb (commit)
via ab5d165659d0867213217f81794d985efa5d87c1 (commit)
via 694c1e7eeadccd40017ca22a95136f3895347ddf (commit)
via d3973b29917e049198badebf65f9e6290734b883 (commit)
via 2158ef60a871a434450021fd5588820ff93fbefa (commit)
via eddb0f17d183cec2013d23e613e70cc03345e57f (commit)
via 4cad82db9f907fb8ffd42303527a976ca226cedd (commit)
via 32693336583eb14b488a01c6ea5f5e002ab3deb0 (commit)
via 6e4c82265c08a3d1631b5194a3cbbb4e1d615f2d (commit)
from fb8cc34e9cffcd563d8dcc2c466a445ce2986d67 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/0703404654d2a40caca...
commit 0703404654d2a40cacae2d94c6e0e22ca28b4acf
Merge: 54f719a 89856f5
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Merge branch 'master' into mono/removing-windom-dependency
Conflicts:
atari/toolbar.c
diff --cc atari/toolbar.c
index 56d3b04,cf68194..0f032b2
mode 100644,100755..100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@@ -175,114 -146,629 +175,354 @@@ static void tb_txt_request_redraw(void
static nserror toolbar_icon_callback( hlcache_handle *handle,
const hlcache_event *event, void *pw );
+/**
+* Find a button for a specific resource ID
+*/
+static struct s_tb_button *find_button(struct s_toolbar *tb, int rsc_id)
+{
+ int i = 0;
+ while (i < tb->btcnt) {
+ if (tb->buttons[i].rsc_id == rsc_id) {
+ return(&tb->buttons[i]);
+ }
+ i++;
+ }
+ return(NULL);
+}
-void toolbar_init( void )
+/**
+* Callback for textarea redraw
+*/
+static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
{
- int i=0, n;
- short vdicolor[3];
- uint32_t rgbcolor;
-
- toolbar_image_folder = nsoption_charp(atari_image_toolbar_folder);
- toolbar_bg_color = (nsoption_colour(atari_toolbar_bg));
- img_toolbar = (nsoption_int( atari_image_toolbar ) > 0 ) ? true : false;
- if( img_toolbar ){
-
- char imgfile[PATH_MAX];
- const char * imgfiletmpl = "toolbar/%s/%s";
- while( tb_buttons[i].rsc_id != 0){
- tb_buttons[i].index = i;
- i++;
- }
- snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder,
- "main.png" );
- toolbar_image = load_icon( imgfile,
- toolbar_icon_callback, NULL );
- snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder,
- "throbber.png" );
- throbber_image = load_icon( imgfile,
- toolbar_icon_callback, NULL );
-
- } else {
- RsrcGaddr( h_gem_rsrc, R_TREE, TOOLBAR, &toolbar_buttons );
- toolbar_buttons->ob_x = 0;
- toolbar_buttons->ob_y = 0;
-
- RsrcGaddr( h_gem_rsrc, R_TREE, THROBBER , &throbber_form );
- throbber_form->ob_x = 0;
- throbber_form->ob_y = 0;
- }
- n = (sizeof( toolbar_styles ) / sizeof( struct s_toolbar_style ));
- for (i=0; i<n; i++) {
- toolbar_styles[i].icon_bgcolor = ABGR_TO_RGB(toolbar_bg_color);
+ GRECT area;
+ struct s_toolbar * tb = (struct s_toolbar *)data;
+
+ if (tb->attached == false) {
+ return;
}
-}
-void toolbar_exit( void )
-{
- if( toolbar_image )
- hlcache_handle_release( toolbar_image );
- if( throbber_image )
- hlcache_handle_release( throbber_image );
+ toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area);
+ area.g_x += x;
+ area.g_y += y;
+ area.g_w = w;
+ area.g_h = h;
+ //dbg_grect("tb_txt_request_redraw", &area);
+ window_schedule_redraw_grect(tb->owner, &area);
+ return;
}
-/**
- * Callback for load_icon(). Should be removed once bitmaps get loaded directly
- * from disc
- */
-static nserror toolbar_icon_callback(hlcache_handle *handle,
- const hlcache_event *event, void *pw)
+static struct s_tb_button *button_init(struct s_toolbar *tb, OBJECT * tree, int index,
+ struct s_tb_button * instance)
{
- if( event->type == CONTENT_MSG_READY ){
- if( handle == toolbar_image ){
- toolbar_image_ready = true;
- if( input_window != NULL )
- tb_update_buttons( input_window, 0 );
- }
- else if( handle == throbber_image ){
- throbber_image_ready = true;
- }
- }
+ *instance = tb_buttons[index];
+ instance->owner = tb;
- return NSERROR_OK;
+ return(instance);
}
-
-
-static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
-{
-
- OBJECT *tree=NULL;
- LGRECT work,clip;
- GRECT todo,crect;
- struct s_tb_button *bt = (struct s_tb_button*)data;
- struct gui_window * gw = bt->gw;
- struct s_toolbar * tb = gw->root->toolbar;
- short pxy[4];
- int bmpx=0, bmpy=0, bmpw=0, bmph = 0, drawstate=0;
- struct bitmap * icon = NULL;
- struct rect icon_clip;
- GRECT icon_dim = {0,0,0,0};
- plot_style_t plot_style_background = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = toolbar_bg_color,
- .stroke_type = PLOT_OP_TYPE_NONE
- };
+static short __CDECL toolbar_url_userdraw(PARMBLK *parmblock)
+{
+ return(0);
+}
- mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
- work.g_h = work.g_h - 1;
- clip = work;
-
- /* return if component and redraw region does not intersect: */
- if (!rc_lintersect( (LGRECT*)&buff[4], &clip)) {
- return;
- }
+void toolbar_init( void )
+{
+ static USERBLK userblk;
- drawstate = bt->state;
- if( img_toolbar ){
+ aes_toolbar = gemtk_obj_get_tree(TOOLBAR);
+ throbber_form = gemtk_obj_get_tree(THROBBER);
- if( toolbar_image_ready == false ){
- return;
- }
+ userblk.ub_code = toolbar_url_userdraw;
+ userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
+ aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk;
- icon = content_get_bitmap( toolbar_image );
- if( icon == NULL ){
- return;
- }
+ aes_toolbar[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
+ aes_toolbar[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
- bmpw = bitmap_get_width(icon);
- bmph = bitmap_get_height(icon);
- bmpx = 0;
- bmpy = 0;
- icon_clip.x0 = bmpx+(toolbar_styles[tb->style].icon_width*bt->index);
- icon_clip.y0 = bmpy+(toolbar_styles[tb->style].icon_height*drawstate);
- icon_clip.x1 = icon_clip.x0+toolbar_styles[tb->style].icon_width;
- icon_clip.y1 = icon_clip.y0+toolbar_styles[tb->style].icon_height;
- icon_dim.g_x = work.g_x-(toolbar_styles[tb->style].icon_width *
bt->index)+toolbar_styles[tb->style].button_vmargin;
- icon_dim.g_y = work.g_y-(toolbar_styles[tb->style].icon_height *
drawstate)+toolbar_styles[tb->style].button_hmargin;
- icon_dim.g_w = toolbar_styles[tb->style].icon_width*(bt->index+1);
- icon_dim.g_h = toolbar_styles[tb->style].icon_height*(drawstate+1);
- } else {
- /* Place the CICON into workarea: */
- tree = &toolbar_buttons[bt->rsc_id];
- if( tree == NULL )
- return;
- tree->ob_x = work.g_x;
- tree->ob_y = work.g_y + (work.g_h - tree->ob_height) / 2;
- if( drawstate == button_off ) {
- tree->ob_state |= OS_DISABLED;
- } else {
- tree->ob_state &= ~OS_DISABLED;
- }
- }
+ /* init default values: */
+ gemtk_obj_set_str_safe(aes_toolbar, TOOLBAR_TB_SRCH, (char*)"");
- /* Setup draw mode: */
- vsf_interior(atari_plot_vdi_handle , 1 );
- vswr_mode(atari_plot_vdi_handle, MD_REPLACE);
-
- /* go through the rectangle list, using classic AES methods. */
- /* Windom ComGetLGrect is buggy for WF_FIRST/NEXTXYWH */
- crect.g_x = clip.g_x;
- crect.g_y = clip.g_y;
- crect.g_w = clip.g_w;
- crect.g_h = clip.g_h;
- wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
- &todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
- while( (todo.g_w > 0) && (todo.g_h > 0) ){
-
- if (rc_intersect(&crect, &todo )) {
-
- struct rect bgclip = {0,0,todo.g_w, todo.g_h};
- pxy[0] = todo.g_x;
- pxy[1] = todo.g_y;
- pxy[2] = todo.g_w + todo.g_x-1;
- pxy[3] = todo.g_h + todo.g_y-1;
-
- vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
- plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h);
- plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background);
-
- if( img_toolbar == true ){
- plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
- icon_dim.g_w, icon_dim.g_h);
- plot_clip( &icon_clip );
- atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
- toolbar_styles[tb->style].icon_bgcolor,
- BITMAPF_BUFFER_NATIVE );
- } else {
- objc_draw( tree, 0, 0, todo.g_x, todo.g_y, todo.g_w, todo.g_h );
- }
- vs_clip(atari_plot_vdi_handle, 0, (short*)&clip );
- }
- wind_get(gw->root->handle->handle, WF_NEXTXYWH,
- &todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
- }
-}
+ area_full_height = aes_toolbar->ob_height;
+ area_search_height = aes_toolbar[TOOLBAR_AREA_SEARCH].ob_height;
+ area_navigation_height = aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_height;
+ init = true;
+}
-static void __CDECL button_click( COMPONENT *c, long buff[8], void * data )
-{
- struct s_tb_button * bt = (struct s_tb_button *)data;
- int i = 0;
- struct gui_window * gw = bt->gw;
- assert( gw );
- gw->root->toolbar->buttons[bt->index].cb_click( gw );
-}
-
-static struct s_tb_button * find_button( struct gui_window * gw, int rsc_id )
-{
- int i = 0;
- while( i < gw->root->toolbar->btcnt ) {
- if( gw->root->toolbar->buttons[i].rsc_id == rsc_id ) {
- return( &gw->root->toolbar->buttons[i] );
- }
- i++;
- }
-}
-
-
-static COMPONENT *button_init( CMP_TOOLBAR t, OBJECT * tree, int index,
- struct s_tb_button * instance )
+void toolbar_exit(void)
{
- int comp_width;
-
- *instance = tb_buttons[index];
- instance->gw = t->owner;
- comp_width = toolbar_styles[t->style].icon_width + \
- ( toolbar_styles[t->style].button_vmargin * 2 );
+}
- instance->comp = mt_CompCreate( &app, CLT_VERTICAL, comp_width, 0 );
- assert( instance->comp );
- instance->comp->bounds.max_width = comp_width;
- mt_CompEvntDataAttach( &app, instance->comp, WM_REDRAW, button_redraw,
- instance );
- mt_CompEvntDataAttach( &app, instance->comp, WM_XBUTTON, button_click,
- instance );
- return instance->comp;
-}
-
-
-static
-void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
+struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
{
- LGRECT work, clip;
- int idx;
- short pxy[4];
- struct s_toolbar * tb;
- struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app,
- c,
- CDT_OWNER );
- plot_style_t plot_style_background = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = toolbar_bg_color,
- .stroke_type = PLOT_OP_TYPE_NONE
- };
-
- tb = gw->root->toolbar;
- mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
- clip = work;
- if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
-
- vsf_interior(atari_plot_vdi_handle , 1 );
- pxy[0] = (short)buff[4];
- pxy[1] = (short)buff[5];
- pxy[2] = (short)buff[4] + buff[6]-1;
- pxy[3] = (short)buff[5] + buff[7]-2;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
-
- if (app.nplanes > 2 ) {
- plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
- plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background);
- }
- else {
- vsf_color(atari_plot_vdi_handle, WHITE );
- v_bar(atari_plot_vdi_handle, (short*)&pxy );
- }
-
- if( img_toolbar ){
+ int i;
+ GRECT url_area;
+ struct s_toolbar *t;
- int bmpx=0, bmpy=0, bmpw=0, bmph = 0, drawstate=0;
- struct rect icon_clip;
- struct bitmap * icon = NULL;
+ LOG((""));
- if( throbber_image_ready == false ){
- return;
- }
- icon = content_get_bitmap( throbber_image );
- if( icon == NULL ){
- return;
- }
-
- if( tb->throbber.running == false ) {
- idx = 0;
- }
- else {
- idx = tb->throbber.index;
- if( idx > tb->throbber.max_index ) {
- idx = tb->throbber.index = 1;
- }
- }
- bmpw = bitmap_get_width(icon);
- bmph = bitmap_get_height(icon);
- bmpx = 0;
- bmpy = 0;
-
- /*
- for some reason, adding
- toolbar_styles[tb->style].button_vmargin to the x pos of
- the plotter shifts the icon a bit to much.
- Maybe that's becasue the icon is inside an padded form.
- */
- plot_set_dimensions(
- work.g_x-(toolbar_styles[tb->style].icon_width * idx),
- work.g_y+toolbar_styles[tb->style].button_hmargin,
- toolbar_styles[tb->style].icon_width*(idx+1),
- toolbar_styles[tb->style].icon_height
- );
- icon_clip.x0 = bmpx+(toolbar_styles[tb->style].icon_width*idx);
- icon_clip.y0 = bmpy;
- icon_clip.x1 = icon_clip.x0+toolbar_styles[tb->style].icon_width;
- icon_clip.y1 = icon_clip.y0+toolbar_styles[tb->style].icon_height;
- plot_clip( &icon_clip );
- atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
- toolbar_styles[tb->style].icon_bgcolor,
- BITMAPF_BUFFER_NATIVE );
- }
- else {
- if( throbber_form != NULL ) {
- if( gw->root->toolbar->throbber.running == false ) {
- idx = THROBBER_INACTIVE_INDEX;
- } else {
- idx = gw->root->toolbar->throbber.index;
- if( idx > THROBBER_MAX_INDEX || idx < THROBBER_MIN_INDEX ) {
- idx = THROBBER_MIN_INDEX;
- }
- }
- throbber_form[idx].ob_x = work.g_x+1;
- throbber_form[idx].ob_y = work.g_y+4;
- mt_objc_draw( throbber_form, idx, 8, clip.g_x, clip.g_y, clip.g_w, clip.g_h,
app.aes_global );
- }
- }
-
-}
-
-static
-void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
-{
- LGRECT work, clip;
- struct gui_window * gw;
- short pxy[10];
- plot_style_t plot_style_background = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = toolbar_bg_color,
- .stroke_type = PLOT_OP_TYPE_NONE
- };
-
- CMP_TOOLBAR tb = (CMP_TOOLBAR)data;
- mt_CompGetLGrect(&app, tb->url.comp, WF_WORKXYWH, &work);
-
- // this last pixel is drawn by the root component of the toolbar:
- // it's the black border, so we leave it out:
- work.g_h--;
- clip = work;
- if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
-
- plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
-
- //left margin:
- plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
- &plot_style_background);
- // right margin:
- plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
- &plot_style_background);
-
- // top margin:
- plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
- &plot_style_background);
-
- // bottom margin:
- plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
- &plot_style_background);
-
- // TBD: request redraw of textarea for specific region.
- clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
- clip.g_y -= work.g_y+TOOLBAR_URL_MARGIN_TOP;
- tb_txt_request_redraw( tb, clip.g_x, clip.g_y, clip.g_w, clip.g_h );
-}
+ assert(init == true);
++<<<<<<< HEAD
+ t = calloc(sizeof(struct s_toolbar), 1);
++=======
+ static
+ void __CDECL evnt_url_click( COMPONENT *c, long buff[8] )
+ {
+ LGRECT work;
+ short pxy[4];
+ short mx, my, mb, kstat;
+ int old;
+ graf_mkstate( &mx, &my, &mb, &kstat );
+ struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, c,
CDT_OWNER);
+ assert( gw != NULL );
+ CMP_TOOLBAR tb = gw->root->toolbar;
+ mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
+ mx = evnt.mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
+ my = evnt.my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
+
+ /* TODO: reset mouse state of browser window? */
+ /* select whole text when newly focused, otherwise set caret to end of text */
+ if( !window_url_widget_has_focus(gw) ) {
+ window_set_focus( gw, URL_WIDGET, (void*)&tb->url );
+ } else {
+ if( mb & 1 ) {
+ textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_DRAG_1,
+ mx, my );
+ short prev_x = mx;
+ short prev_y = my;
+ do{
+ if( abs(prev_x-mx) > 5 || abs(prev_y-my) > 5 ){
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_HOLDING_1, mx, my );
+ prev_x = mx;
+ prev_y = my;
+ if( tb->url.redraw ){
+ tb_url_redraw( gw );
+ }
+ }
+ graf_mkstate( &mx, &my, &mb, &kstat );
+ mx = mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
+ my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
+ }while( mb & 1 );
+ textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_HOVER, mx, my );
+ } else {
+ /* TODO: recognize click + shift key */
+ int mstate = BROWSER_MOUSE_PRESS_1;
+ if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 )
+ mstate = BROWSER_MOUSE_MOD_1;
+ if( evnt.nb_click == 2 ){
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_DOUBLE_CLICK | BROWSER_MOUSE_CLICK_1,
+ mx, my );
+ } else {
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_PRESS_1, mx, my );
+ }
+ }
+ }
+ // TODO: do not send an complete redraw!
+ ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
+ work.g_x, work.g_y, work.g_w, work.g_h );
+ }
++>>>>>>> master
+
+ assert(t);
++<<<<<<< HEAD
+ /* initialize the toolbar values: */
+ t->owner = owner;
+ t->style = 1;
+ t->search_visible = false;
+ t->visible = true;
+ t->reflow = true;
+ /* dublicate the form template: */
+ t->form = gemtk_obj_tree_copy(aes_toolbar);
++=======
+ void tb_adjust_size( struct gui_window * gw )
+ {
+ LGRECT work;
+ CMP_TOOLBAR t = gw->root->toolbar;
+
+ mt_CompGetLGrect( &app, t->url.comp, WF_WORKXYWH, &work);
+ work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
+ /* do not overwrite the black border, because of that, add 1 */
+ work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
+ textarea_set_dimensions( t->url.textarea, work.g_w, work.g_h );
+ tb_txt_request_redraw( t, 0,0, work.g_w-1, work.g_h-1);
+ }
+
+ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data )
+ {
+ LGRECT work, clip;
+ short pxy[4];
+ const plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
+
+ mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
+ clip = work;
+ if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
+ if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
+
+ vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
+ vsl_color(atari_plot_vdi_handle, BLACK );
+ vsl_type(atari_plot_vdi_handle, 1 );
+ vsl_width(atari_plot_vdi_handle, 1 );
+ pxy[0] = clip.g_x;
+ pxy[1] = pxy[3] = work.g_y + work.g_h-1 ;
+ pxy[2] = clip.g_x + clip.g_w;
+ v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
+ }
+
+
+ static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
+ {
+ LGRECT work;
+ if( data == NULL )
+ return;
+ CMP_TOOLBAR t = data;
+ if( t->url.redraw == false ){
+ t->url.redraw = true;
+ //t->redraw = true;
+ t->url.rdw_area.g_x = x;
+ t->url.rdw_area.g_y = y;
+ t->url.rdw_area.g_w = w;
+ t->url.rdw_area.g_h = h;
+ } else {
+ /* merge the redraw area to the new area.: */
+ int newx1 = x+w;
+ int newy1 = y+h;
+ int oldx1 = t->url.rdw_area.g_x + t->url.rdw_area.g_w;
+ int oldy1 = t->url.rdw_area.g_y + t->url.rdw_area.g_h;
+ t->url.rdw_area.g_x = MIN(t->url.rdw_area.g_x, x);
+ t->url.rdw_area.g_y = MIN(t->url.rdw_area.g_y, y);
+ t->url.rdw_area.g_w = ( oldx1 > newx1 ) ?
+ oldx1 - t->url.rdw_area.g_x : newx1 - t->url.rdw_area.g_x;
+ t->url.rdw_area.g_h = ( oldy1 > newy1 ) ?
+ oldy1 - t->url.rdw_area.g_y : newy1 - t->url.rdw_area.g_y;
+ }
+ }
+
+
+ static void tb_txt_callback(void *data, struct textarea_msg *msg)
+ {
+ switch (msg->type) {
+ case TEXTAREA_MSG_DRAG_REPORT:
+ break;
+
+ case TEXTAREA_MSG_REDRAW_REQUEST:
+ tb_txt_request_redraw(data,
+ msg->data.redraw.x0, msg->data.redraw.y0,
+ msg->data.redraw.x1 - msg->data.redraw.x0,
+ msg->data.redraw.y1 - msg->data.redraw.y0);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ void tb_url_redraw( struct gui_window * gw )
+ {
+
+ CMP_TOOLBAR t = gw->root->toolbar;
+ if (t != NULL) {
+ if( t->url.redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) )
{
+
+ const struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
+ short todo[4];
+ LGRECT work;
+
+ mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH,
&work);
+ work.g_x += TOOLBAR_URL_MARGIN_RIGHT;
+ work.g_y += TOOLBAR_URL_MARGIN_LEFT;
+ work.g_w -= TOOLBAR_URL_MARGIN_RIGHT;
+ work.g_h -= TOOLBAR_URL_MARGIN_BOTTOM;
+
+ plot_set_dimensions( work.g_x, work.g_y, work.g_w, work.g_h );
+ if(plot_lock() == false)
+ return;
+
+ todo[0] = work.g_x;
+ todo[1] = work.g_y;
+ todo[2] = todo[0] + work.g_w-1;
+ todo[3] = todo[1] + work.g_h-1;
+ vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
+
+ if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
+ while (todo[2] && todo[3]) {
+
+ /* convert screen to relative coords: */
+ todo[0] = todo[0] - work.g_x;
+ todo[1] = todo[1] - work.g_y;
+ if( todo[0] < 0 ){
+ todo[2] = todo[2] + todo[0];
+ todo[0] = 0;
+ }
+ if( todo[1] < 0 ){
+ todo[3] = todo[3] + todo[1];
+ todo[1] = 0;
+ }
+
+ if (rc_intersect(&t->url.rdw_area,(GRECT *)&todo)) {
+ struct rect clip = {
+ .x0 = todo[0],
+ .y0 = todo[1],
+ .x1 = todo[0]+todo[2],
+ .y1 = todo[1]+todo[3]
+ };
+ textarea_redraw( t->url.textarea, 0, 0, 0xffffff, &clip, &ctx );
+ }
+ if (wind_get(gw->root->handle->handle, WF_NEXTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3])==0) {
+ break;
+ }
+ }
+ } else {
+ plot_unlock();
+ return;
+ }
+ plot_unlock();
+ vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
+ t->url.redraw = false;
+ t->url.rdw_area.g_x = 65000;
+ t->url.rdw_area.g_y = 65000;
+ t->url.rdw_area.g_w = -1;
+ t->url.rdw_area.g_h = -1;
+ } else {
+ /* just copy stuff from the offscreen buffer */
+ }
+ }
+ }
+
+ CMP_TOOLBAR tb_create( struct gui_window * gw )
+ {
+ int i;
+
+
+ CMP_TOOLBAR t = malloc( sizeof(struct s_toolbar) );
+ if( t == NULL )
+ return( NULL );
+
+ t->owner = gw;
+ t->style = 1;
++>>>>>>> master
- /* create the root component: */
- t->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL,
- toolbar_styles[t->style].height, 0 );
- t->comp->rect.g_h = toolbar_styles[t->style].height;
- t->comp->bounds.max_height = toolbar_styles[t->style].height;
- mt_CompEvntDataAdd(&app, t->comp, WM_REDRAW, evnt_toolbar_redraw,
- gw, EV_BOT);
/* count buttons and add them as components: */
i = 0;
@@@ -300,151 -787,87 +540,182 @@@
font_style_url.size =
toolbar_styles[t->style].font_height_pt * FONT_SIZE_SCALE;
++<<<<<<< HEAD
+ toolbar_get_grect(t, TOOLBAR_AREA_URL, &url_area);
+ url_area.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
+ t->url.textarea = textarea_create(300, url_area.g_h, 0, &font_style_url,
+ tb_txt_request_redraw, t);
++=======
+ int ta_height = toolbar_styles[t->style].height;
+ ta_height -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
+ textarea_setup ta_setup;
+ ta_setup.flags = TEXTAREA_INTERNAL_CARET;
+ ta_setup.width = 300;
+ ta_setup.height = ta_height;
+ ta_setup.pad_top = 0;
+ ta_setup.pad_right = 4;
+ ta_setup.pad_bottom = 0;
+ ta_setup.pad_left = 4;
+ ta_setup.border_width = 1;
+ ta_setup.border_col = 0x000000;
+ ta_setup.selected_text = 0xffffff;
+ ta_setup.selected_bg = 0x000000;
+ ta_setup.text = font_style_url;
+ ta_setup.text.foreground = 0x000000;
+ ta_setup.text.background = 0xffffff;
+ t->url.textarea = textarea_create( &ta_setup, tb_txt_callback, t );
+ if( t->url.textarea != NULL ){
+ textarea_set_text(t->url.textarea, "http://");
+ }
+
+ t->url.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL,
+ toolbar_styles[t->style].height, 1);
+ mt_CompEvntDataAttach( &app, t->url.comp, WM_REDRAW, evnt_url_redraw, t);
+ mt_CompEvntAttach( &app, t->url.comp, WM_XBUTTON, evnt_url_click );
+ mt_CompDataAttach( &app, t->url.comp, CDT_OWNER, gw );
+ mt_CompAttach( &app, t->comp, t->url.comp );
++>>>>>>> master
/* create the throbber widget: */
- t->throbber.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL,
- toolbar_styles[t->style].height, 0);
- t->throbber.comp->rect.g_h = toolbar_styles[t->style].height;
- t->throbber.comp->rect.g_w = t->throbber.comp->bounds.max_width = \
- toolbar_styles[t->style].icon_width + \
- (2*toolbar_styles[t->style].button_vmargin );
- t->throbber.comp->bounds.max_height = toolbar_styles[t->style].height;
- if( img_toolbar == true ){
- t->throbber.index = 0;
- t->throbber.max_index = 8;
- } else {
- t->throbber.index = THROBBER_MIN_INDEX;
- t->throbber.max_index = THROBBER_MAX_INDEX;
- }
- t->throbber.running = false;
- mt_CompEvntAttach( &app, t->throbber.comp, WM_REDRAW, evnt_throbber_redraw );
- mt_CompDataAttach( &app, t->throbber.comp, CDT_OWNER, gw );
- mt_CompAttach( &app, t->comp, t->throbber.comp );
+ t->throbber.index = THROBBER_INACTIVE_INDEX;
+ t->throbber.max_index = THROBBER_MAX_INDEX;
+ t->throbber.running = false;
+
+ LOG(("created toolbar: %p, root: %p, textarea: %p, throbber: %p", t,
+ owner, t->url.textarea, t->throbber));
return( t );
-}
-
-
-void tb_destroy( CMP_TOOLBAR tb )
+}
+
+
+void toolbar_destroy(struct s_toolbar *tb)
{
- free( tb->buttons );
- textarea_destroy( tb->url.textarea );
- mt_CompDelete( &app, tb->comp);
- free( tb );
-}
-
-
-struct gui_window * tb_gui_window( CMP_TOOLBAR tb )
-{
- struct gui_window * gw;
- gw = window_list;
- while( gw != NULL ) {
- if( gw->root->toolbar == tb ) {
- LOG(("found tb gw: %p (tb: %p) for tb: %p", gw, gw->root->toolbar, tb
));
- return( gw );
- }
- else
- gw = gw->next;
- }
- return( NULL );
-}
-
-
-void tb_update_buttons( struct gui_window * gw, short button )
+ free(tb->buttons);
+ free(tb->form);
+
+ textarea_destroy(tb->url.textarea);
+
+ free(tb);
+}
+
+static int toolbar_calculate_height(struct s_toolbar *tb)
{
-
-#define FIRST_BUTTON TOOLBAR_BT_BACK
+ int r = 0;
+
+ if (tb->visible == false) {
+ return(0);
+ }
+
+ r += area_navigation_height;
+
+ if (tb->search_visible) {
+ r += area_search_height;
+ }
+
+ return(r);
+}
+
+static void toolbar_reflow(struct s_toolbar *tb)
+{
+ int i;
+
+ // position toolbar areas:
+ tb->form->ob_x = tb->area.g_x;
+ tb->form->ob_y = tb->area.g_y;
+ tb->form->ob_width = tb->area.g_w;
+ tb->form->ob_height = toolbar_calculate_height(tb);
+
+ // expand the "main" areas to the current width:
+ tb->form[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w;
+
+ if (tb->search_visible) {
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
+ } else {
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
+
+ }
+
+ // align the throbber area at right edge:
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_THROBBER_AREA].ob_width;
+
+ // align the search button:
+ tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
+
+ // center the URL area:
+ tb->form[TOOLBAR_AREA_URL].ob_width = tb->area.g_w
+ - (tb->form[TOOLBAR_AREA_BUTTONS].ob_width
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_width + 1);
+
+
+ // position throbber image:
+ throbber_form[tb->throbber.index].ob_x = tb->area.g_x +
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x;
+
+ throbber_form[tb->throbber.index].ob_x = tb->area.g_x
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_x +
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_width
+ - throbber_form[tb->throbber.index].ob_width) >> 1);
+
+ throbber_form[tb->throbber.index].ob_y = tb->area.g_y +
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_height
+ - throbber_form[tb->throbber.index].ob_height) >> 1);
+
+ // set button states:
+ for (i=0; i < tb->btcnt; i++ ) {
+ if (tb->buttons[i].state == button_off) {
+ tb->form[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED;
+ }
+ else if (tb->buttons[i].state == button_on) {
+ tb->form[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED;
+ }
+ }
+ tb->reflow = false;
+ // TODO: iterate through all other toolbars and set reflow = true
+}
+
+void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
+{
+ GRECT area, area_ro;
+
+ if (tb->attached == false) {
+ return;
+ }
+
+ if(tb->reflow == true)
+ toolbar_reflow(tb);
+
+ //TODO: fix redraw under popup menu ... that not handled correctly somehow.
+
+ //dbg_grect("toolbar redraw clip", clip);
+
+ objc_draw_grect(tb->form,0,8,clip);
+ objc_draw_grect(&throbber_form[tb->throbber.index], 0, 1, clip);
+
+ toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area_ro);
+ area = area_ro;
+
+ if (rc_intersect(clip, &area)) {
+
+ plot_set_dimensions(area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h);
+ struct rect r = {
+ .x0 = MAX(0,area.g_x - area_ro.g_x),
+ .y0 = MAX(0,area.g_y - area_ro.g_y),
+ .x1 = MAX(0,area.g_x - area_ro.g_x) + area.g_w,
+ .y1 = MAX(0,area.g_y - area_ro.g_y) + area.g_h
+ };
+ //dbg_rect("tb textarea clip: ", &r);
+ // TODO: let this be handled by an userdef object redraw function:
+ textarea_redraw(tb->url.textarea, 0, 0, &r, &toolbar_rdrw_ctx);
+ }
+}
+
+
+void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw,
+ short button)
+{
+ LOG((""));
struct s_tb_button * bt;
bool enable = false;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/54f719aa960159c5b19...
commit 54f719aa960159c5b1978846223732c9669ca7fa
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Some more finetuning...
diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults
index a8b1857..83464d6 100644
--- a/atari/Makefile.defaults
+++ b/atari/Makefile.defaults
@@ -32,6 +32,10 @@
# Valid options: YES, NO
NETSURF_USE_ATARI_NETSURF_FONT := YES
+ # Enable VDI Font rendering
+ # Valid options: YES, NO
+ NETSURF_USE_ATARI_VDI_FONT := NO
+
# Configure support for screen drivers with no true colour mode
# Valid options: YES, NO
NETSURF_USE_ATARI_8BPP_SUPPORT := NO
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 169e3c7..d339292 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -40,6 +40,7 @@ $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng)))
$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript
(Spidermonkey)))
$(eval $(call
feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype)))
$(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal
Font)))
+$(eval $(call feature_enabled,ATARI_VDI_FONT,-DWITH_VDI_FONT_DRIVER,,(Internal Font)))
$(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen
format support)))
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
@@ -104,6 +105,7 @@ S_ATARI := \
plot/eddi.s \
plot/font_freetype.c \
plot/font_internal.c \
+ plot/font_vdi.c \
gemtk/aestabs.c \
gemtk/dragdrop.c \
gemtk/guiwin.c \
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index 0811b12..df31ba0 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -268,8 +268,13 @@ static void __CDECL menu_find(short item, short title, void *data)
{
static bool visible = false;
LOG(("%s", __FUNCTION__));
- if( input_window != NULL ){
- window_open_search(input_window->root, true);
+ if (input_window != NULL) {
+ if (input_window->search) {
+ window_close_search(input_window->root);
+ }
+ else {
+ window_open_search(input_window->root, true);
+ }
}
}
diff --git a/atari/encoding.c b/atari/encoding.c
index 2cd2670..75d0fec 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -67,3 +67,5 @@ int atari_to_ucs4(unsigned char atari)
ucs4 = (int)atari;
return( ucs4 );
}
+
+
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index e187aea..1853e75 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -112,7 +112,7 @@ short gemtk_msg_box_show(short type, const char * msg);
#define GEMTK_WM_VSLIDER 0x01
#define GEMTK_WM_HSLIDER 0x02
-#define GEMTK_WM_VH_SLIDER 0x03
+#define GEMTK_WM_VH_SLIDER 0x03
/*
Message sent to the client application when an AES object is
@@ -123,7 +123,8 @@ short gemtk_msg_box_show(short type, const char * msg);
msg[5] = Number of clicks.
msg[6] = Modifier keys.
*/
-#define GEMTK_WM_WM_FORM 1001
+#define GEMTK_WM_WM_FORM_CLICK 1001
+#define GEMTK_WM_WM_FORM_KEY 1002
struct gemtk_window_s;
@@ -182,6 +183,10 @@ short gemtk_wm_remove(GUIWIN *win);
GUIWIN * gemtk_wm_validate_ptr(GUIWIN *win);
+GUIWIN *gemtk_wm_link(GUIWIN *win);
+
+GUIWIN *gemtk_wm_unlink(GUIWIN *win);
+
short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]);
void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest);
@@ -224,6 +229,8 @@ void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area);
VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win);
+short getm_wm_get_toolbar_edit_obj(GUIWIN *win);
+
bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work);
void gemtk_wm_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip);
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 95e9b08..0334e58 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -434,7 +434,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
}
short oldevents = ev_out->emo_events;
- short msg_out[8] = { GEMTK_WM_WM_FORM, gl_apid,
+ short msg_out[8] = { GEMTK_WM_WM_FORM_CLICK, gl_apid,
0, gw->handle,
gw->form_focus_obj, ev_out->emo_mclicks,
ev_out->emo_kmeta, 0
@@ -484,7 +484,9 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
ev_out->emo_kreturn, &edit_idx,
EDCHAR, gw->handle);
}
- retval = 1;
+ //retval = 1;
+ /*gemtk_wm_send_msg(gw, GEMTK_WM_WM_FORM_KEY, gw->toolbar_edit_obj,
+ ev_out->emo_kreturn, 0, 0);*/
}
if((gw->form != NULL) && (gw->form_edit_obj > -1) ) {
@@ -649,19 +651,7 @@ GUIWIN * gemtk_wm_add(short handle, uint32_t flags,
gemtk_wm_event_handler_f cb)
win->handle = handle;
win->handler_func = cb;
win->flags = flags;
- if (winlist == NULL) {
- winlist = win;
- win->next = NULL;
- win->prev = NULL;
- } else {
- GUIWIN *tmp = winlist;
- while( tmp->next != NULL ) {
- tmp = tmp->next;
- }
- tmp->next = win;
- win->prev = tmp;
- win->next = NULL;
- }
+ gemtk_wm_link(win);
DEBUG_PRINT(("Added guiwin: %p, tb: %p\n", win, win->toolbar));
return(win);
@@ -700,15 +690,41 @@ GUIWIN *gemtk_wm_validate_ptr(GUIWIN *win)
return(NULL);
}
-/**
-* Remove an GUIWIN from the list of managed windows.
-* Call this when the AES window is closed or deleted.
-*/
-short gemtk_wm_remove(GUIWIN *win)
+GUIWIN *gemtk_wm_link(GUIWIN *win)
{
- win = gemtk_wm_validate_ptr(win);
- if (win == NULL)
- return(-1);
+ /* Make sure the window is not linked: */
+ GUIWIN *win_val = gemtk_wm_validate_ptr(win);
+ if(win_val){
+ DEBUG_PRINT(("GUIWIN %p is already linked!\n", win));
+ return(NULL);
+ }
+
+ if (winlist == NULL) {
+ winlist = win;
+ win->next = NULL;
+ win->prev = NULL;
+ } else {
+ GUIWIN *tmp = winlist;
+ while( tmp->next != NULL ) {
+ tmp = tmp->next;
+ }
+ tmp->next = win;
+ win->prev = tmp;
+ win->next = NULL;
+ }
+}
+
+GUIWIN *gemtk_wm_unlink(GUIWIN *win)
+{
+ GUIWIN * win_val;
+
+ /* Make sure the window is linked: */
+ win_val = gemtk_wm_validate_ptr(win);
+ if (win_val == NULL){
+ DEBUG_PRINT(("GUIWIN %p is not linked!\n", win));
+ return(NULL);
+ }
+
/* unlink the window: */
if(win->prev != NULL ) {
@@ -719,6 +735,16 @@ short gemtk_wm_remove(GUIWIN *win)
if (win->next != NULL) {
win->next->prev = win->prev;
}
+ return(win);
+}
+
+/**
+* Remove an GUIWIN from the list of managed windows and free the GUIWIN.
+* Call this when the AES window is closed or deleted.
+*/
+short gemtk_wm_remove(GUIWIN *win)
+{
+ gemtk_wm_unlink(win);
DEBUG_PRINT(("guiwin free: %p\n", win));
free(win);
return(0);
@@ -990,6 +1016,11 @@ void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s)
win->toolbar_size = s;
}
+short getm_wm_get_toolbar_edit_obj(GUIWIN *win)
+{
+ return(win->toolbar_edit_obj);
+}
+
/** Set the current active edit object */
void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn)
{
diff --git a/atari/gui.c b/atari/gui.c
index c957baf..a59caa8 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -81,7 +81,6 @@ struct gui_window *window_list = NULL;
void * h_gem_rsrc;
long next_poll;
bool rendering = false;
-bool gui_poll_repeat = false;
GRECT desk_area;
@@ -117,81 +116,68 @@ short aes_msg_out[8];
void gui_poll(bool active)
{
+ struct gui_window *tmp;
short mx, my, dummy;
- unsigned short nkc = 0;
-
- gui_poll_repeat = false;
+ unsigned short nkc = 0;
aes_event_in.emi_tlow = schedule_run();
- if(active || rendering)
- aes_event_in.emi_tlow = 0;
+ if(active || rendering)
+ aes_event_in.emi_tlow = 0;
- if(aes_event_in.emi_tlow < 0){
- aes_event_in.emi_tlow = 10000;
- printf("long poll!\n");
- }
+ if(aes_event_in.emi_tlow < 0) {
+ aes_event_in.emi_tlow = 10000;
+ printf("long poll!\n");
+ }
struct gui_window * g;
if( !active ) {
- if(input_window && input_window->root->redraw_slots.areas_used > 0){
- window_process_redraws(input_window->root);
- }
- /* this suits for stuff with lower priority */
- /* TBD: really be spare on redraws??? */
- hotlist_redraw();
- global_history_redraw();
+ if(input_window && input_window->root->redraw_slots.areas_used >
0) {
+ window_process_redraws(input_window->root);
+ }
}
- // Handle events until there are no more messages pending or
- // until the engine indicates activity:
- bool skip = false;
-/*
- if (active || rendering){
- if ((clock() < next_poll)){
- skip = true;
- } else {
- next_poll = clock() + (CLOCKS_PER_SEC>>5);
- }
- }
-*/
- //if (skip == false) {
- do {
- short mx, my, dummy;
-
- graf_mkstate(&mx, &my, &dummy, &dummy);
- aes_event_in.emi_m1.g_x = mx;
- aes_event_in.emi_m1.g_y = my;
- evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
- if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
- if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
- LOG(("WM: %d\n", aes_msg_out[0]));
- switch(aes_msg_out[0]) {
-
- case MN_SELECTED:
- LOG(("Menu Item: %d\n",aes_msg_out[4]));
- deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
- break;
- default:
- break;
- }
- }
- if((aes_event_out.emo_events & MU_KEYBD) != 0) {
- uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
- (short)aes_event_out.emo_kreturn);
- deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
- aes_event_out.emo_kmeta, nkc);
- }
- }
- } while ( gui_poll_repeat && !(active||rendering));
- if(input_window && input_window->root->redraw_slots.areas_used > 0){
- window_process_redraws(input_window->root);
+ graf_mkstate(&mx, &my, &dummy, &dummy);
+ aes_event_in.emi_m1.g_x = mx;
+ aes_event_in.emi_m1.g_y = my;
+ evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
+ if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
+ if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
+ LOG(("WM: %d\n", aes_msg_out[0]));
+ switch(aes_msg_out[0]) {
+
+ case MN_SELECTED:
+ LOG(("Menu Item: %d\n",aes_msg_out[4]));
+ deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
+ break;
+ default:
+ break;
+ }
+ }
+ if((aes_event_out.emo_events & MU_KEYBD) != 0) {
+ uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
+ (short)aes_event_out.emo_kreturn);
+ deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
+ aes_event_out.emo_kmeta, nkc);
+ }
+ }
+
+ tmp = window_list;
+ while(tmp){
+ if(tmp->root->redraw_slots.areas_used > 0){
+ window_process_redraws(tmp->root);
}
- //} else {
- //printf("skip poll %d (%d)\n", next_poll, clock());
- //}
+ tmp = tmp->next;
+ }
+ if(hl.tv->redraw){
+ atari_treeview_redraw(hl.tv);
+ }
+
+ if(gl_history.tv->redraw){
+ atari_treeview_redraw(gl_history.tv);
+ }
}
@@ -248,11 +234,11 @@ void gui_window_destroy(struct gui_window *w)
LOG(("%s\n", __FUNCTION__ ));
- if (input_window == w) {
- gui_set_input_gui_window(NULL);
+ if (input_window == w) {
+ gui_set_input_gui_window(NULL);
}
- nsatari_search_session_destroy(w->search);
+ nsatari_search_session_destroy(w->search);
free(w->browser);
free(w->status);
free(w->title);
@@ -273,11 +259,11 @@ void gui_window_destroy(struct gui_window *w)
free(w);
w = NULL;
- if(input_window == NULL){
+ if(input_window == NULL) {
w = window_list;
while( w != NULL ) {
if(w->root) {
- gui_set_input_gui_window(w);
+ gui_set_input_gui_window(w);
break;
}
w = w->next;
@@ -307,7 +293,7 @@ void gui_window_set_title(struct gui_window *gw, const char *title)
int l;
char * conv;
l = strlen(title)+1;
- if (utf8_to_local_encoding(title, l, &conv) == UTF8_CONVERT_OK ) {
+ if (utf8_to_local_encoding(title, l-1, &conv) == UTF8_CONVERT_OK ) {
l = MIN((uint32_t)atari_sysinfo.aes_max_win_title_len, strlen(conv));
if(gw->title == NULL)
gw->title = malloc(l);
@@ -367,8 +353,8 @@ void gui_window_redraw_window(struct gui_window *gw)
void gui_window_update_box(struct gui_window *gw, const struct rect *rect)
{
- GRECT area;
- struct gemtk_wm_scroll_info_s *slid;
+ GRECT area;
+ struct gemtk_wm_scroll_info_s *slid;
if (gw == NULL)
return;
@@ -376,8 +362,8 @@ void gui_window_update_box(struct gui_window *gw, const struct rect
*rect)
slid = gemtk_wm_get_scroll_info(gw->root->win);
window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
- area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
- area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
+ area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
+ area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
area.g_w = rect->x1 - rect->x0;
area.g_h = rect->y1 - rect->y0;
//dbg_grect("update box", &area);
@@ -386,11 +372,11 @@ void gui_window_update_box(struct gui_window *gw, const struct rect
*rect)
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
{
- int x,y;
+ int x,y;
if (w == NULL)
return false;
- window_get_scroll(w->root, sx, sy);
+ window_get_scroll(w->root, sx, sy);
return( true );
}
@@ -399,12 +385,12 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
{
int units = 0;
if ((w == NULL)
- || (w->browser->bw == NULL)
- || (w->browser->bw->current_content == NULL))
- return;
+ || (w->browser->bw == NULL)
+ || (w->browser->bw->current_content == NULL))
+ return;
- //printf("scroll %d, %d\n", sx, sy);
- window_scroll_by(w->root, sx, sy);
+ LOG(("scroll (gui_window: %p) %d, %d\n", w, sx, sy));
+ window_scroll_by(w->root, sx, sy);
return;
}
@@ -412,9 +398,7 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1)
{
LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1));
- printf("scroll visible\n");
gui_window_set_scroll(w,x0,y0);
- //browser_schedule_redraw_rect( w, 0, 0, x1-x0,y1-y0);
}
@@ -427,11 +411,11 @@ void gui_window_update_extent(struct gui_window *gw)
if( gw->browser->bw->current_content != NULL ) {
// TODO: store content size!
- if(window_get_active_gui_window(gw->root) == gw){
+ if(window_get_active_gui_window(gw->root) == gw) {
window_set_content_size( gw->root,
-
content_get_width(gw->browser->bw->current_content),
-
content_get_height(gw->browser->bw->current_content)
- );
+
content_get_width(gw->browser->bw->current_content),
+
content_get_height(gw->browser->bw->current_content)
+ );
window_update_back_forward(gw->root);
GRECT area;
window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
@@ -549,7 +533,7 @@ void gui_window_set_url(struct gui_window *w, const char *url)
}
strncpy(w->url, url, l);
w->url[l] = 0;
- if(input_window == w->root->active_gui_window){
+ if(input_window == w->root->active_gui_window) {
toolbar_set_url(w->root->toolbar, url);
}
}
@@ -599,8 +583,8 @@ void gui_window_stop_throbber(struct gui_window *w)
/* Place caret in window */
void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
{
- window_place_caret(w->root, 1, x, y, height, NULL);
- w->root->caret.state |= CARET_STATE_ENABLED;
+ window_place_caret(w->root, 1, x, y, height, NULL);
+ w->root->caret.state |= CARET_STATE_ENABLED;
return;
}
@@ -614,11 +598,11 @@ gui_window_remove_caret(struct gui_window *w)
if (w == NULL)
return;
- if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) {
- //printf("gw hide caret\n");
- window_place_caret(w->root, 0, -1, -1, -1, NULL);
- w->root->caret.state &= ~CARET_STATE_ENABLED;
- }
+ if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) {
+ //printf("gw hide caret\n");
+ window_place_caret(w->root, 0, -1, -1, -1, NULL);
+ w->root->caret.state &= ~CARET_STATE_ENABLED;
+ }
return;
}
@@ -629,7 +613,7 @@ gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL;
g->icon = bmp_icon;
- if(input_window == g){
+ if(input_window == g) {
window_set_icon(g->root, bmp_icon);
}
}
@@ -642,10 +626,10 @@ gui_window_set_search_ico(hlcache_handle *ico)
void gui_window_new_content(struct gui_window *w)
{
- struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
- slid->x_pos = 0;
- slid->y_pos = 0;
- gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
+ slid->x_pos = 0;
+ slid->y_pos = 0;
+ gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER);
gui_window_redraw_window(w);
}
@@ -696,37 +680,36 @@ void gui_start_selection(struct gui_window *w)
*/
void gui_get_clipboard(char **buffer, size_t *length)
{
- char *clip;
- size_t clip_len;
+ char *clip;
+ size_t clip_len;
- *length = 0;
- *buffer = 0;
+ *length = 0;
+ *buffer = 0;
- clip = scrap_txt_read();
+ clip = scrap_txt_read();
- if(clip == NULL){
- return;
- } else {
+ if(clip == NULL) {
+ return;
+ } else {
- // clipboard is in atari encoding, convert it to utf8:
+ // clipboard is in atari encoding, convert it to utf8:
- char *utf8 = NULL;
- utf8_convert_ret ret;
+ char *utf8 = NULL;
+ utf8_convert_ret ret;
- clip_len = strlen(clip);
- if (clip_len > 0) {
- ret = utf8_to_local_encoding(clip, clip_len, &utf8);
- if (ret == UTF8_CONVERT_OK && utf8 != NULL) {
- *buffer = utf8;
- *length = strlen(utf8);
- }
- else {
- assert(ret == UTF8_CONVERT_OK && utf8 != NULL);
- }
- }
+ clip_len = strlen(clip);
+ if (clip_len > 0) {
+ ret = utf8_to_local_encoding(clip, clip_len, &utf8);
+ if (ret == UTF8_CONVERT_OK && utf8 != NULL) {
+ *buffer = utf8;
+ *length = strlen(utf8);
+ } else {
+ assert(ret == UTF8_CONVERT_OK && utf8 != NULL);
+ }
+ }
- free(clip);
- }
+ free(clip);
+ }
}
/**
@@ -738,23 +721,23 @@ void gui_get_clipboard(char **buffer, size_t *length)
* \param n_styles Number of text run styles in array
*/
void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
+ nsclipboard_styles styles[], int n_styles)
{
- if (length > 0 && buffer != NULL) {
+ if (length > 0 && buffer != NULL) {
- // convert utf8 input to atari encoding:
+ // convert utf8 input to atari encoding:
- utf8_convert_ret ret;
- char *clip = NULL;
+ utf8_convert_ret ret;
+ char *clip = NULL;
- ret = utf8_to_local_encoding(buffer,length, &clip);
- if (ret == UTF8_CONVERT_OK) {
- scrap_txt_write(clip);
- } else {
- assert(ret == UTF8_CONVERT_OK);
- }
- free(clip);
- }
+ ret = utf8_to_local_encoding(buffer,length, &clip);
+ if (ret == UTF8_CONVERT_OK) {
+ scrap_txt_write(clip);
+ } else {
+ assert(ret == UTF8_CONVERT_OK);
+ }
+ free(clip);
+ }
}
@@ -787,7 +770,7 @@ void gui_401login_open(nsurl *url, const char *realm,
free( out );
}
if (cb != NULL) {
- cb(bres, cbpw);
+ cb(bres, cbpw);
}
}
@@ -810,8 +793,8 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
void gui_set_input_gui_window(struct gui_window *gw)
{
- LOG(("Setting input window from: %p to %p\n", input_window, gw));
- input_window = gw;
+ LOG(("Setting input window from: %p to %p\n", input_window, gw));
+ input_window = gw;
}
void gui_quit(void)
@@ -863,7 +846,7 @@ process_cmdline(int argc, char** argv)
option_window_y = nsoption_int(window_y);
if (option_window_width <= desk_area.g_w
- && option_window_height < desk_area.g_h) {
+ && option_window_height < desk_area.g_h) {
set_default_dimensions = false;
}
}
@@ -962,7 +945,7 @@ static void gui_init(int argc, char** argv)
die("Uable to open GEM Resource file!");
}
- wind_get_grect(0, WF_WORKXYWH, &desk_area);
+ wind_get_grect(0, WF_WORKXYWH, &desk_area);
create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam );
@@ -1005,19 +988,19 @@ static void gui_init(int argc, char** argv)
if (process_cmdline(argc,argv) != true)
die("unable to process command line.\n");
- LOG(("Initializing NKC..."));
+ LOG(("Initializing NKC..."));
nkc_init();
- LOG(("Initializing plotters..."));
+ LOG(("Initializing plotters..."));
plot_init(nsoption_charp(atari_font_driver));
tree_set_icon_dir(nsoption_charp(tree_icons_path));
- aes_event_in.emi_m1leave = MO_LEAVE;
- aes_event_in.emi_m1.g_w = 1;
- aes_event_in.emi_m1.g_h = 1;
- //next_poll = clock() + (CLOCKS_PER_SEC>>3);
+ aes_event_in.emi_m1leave = MO_LEAVE;
+ aes_event_in.emi_m1.g_w = 1;
+ aes_event_in.emi_m1.g_h = 1;
+ //next_poll = clock() + (CLOCKS_PER_SEC>>3);
}
static char *theapp = (char*)"NetSurf";
@@ -1072,7 +1055,7 @@ int main(int argc, char** argv)
graf_mouse( ARROW , NULL);
- LOG(("Creating initial browser window..."));
+ LOG(("Creating initial browser window..."));
browser_window_create(option_homepage_url, 0, 0, true, false);
LOG(("Entering NetSurf mainloop..."));
@@ -1084,7 +1067,7 @@ int main(int argc, char** argv)
fclose(stdout);
fclose(stderr);
#endif
- exit_gem();
+ exit_gem();
return 0;
}
diff --git a/atari/history.c b/atari/history.c
index 6d52c4e..aa32cbf 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -83,7 +83,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
{
NSTREEVIEW tv=NULL;
- printf("Hotlist event %d, open: %d\n", ev_out->emo_events,
gl_history.open);
+ //printf("Hotlist event %d, open: %d\n", ev_out->emo_events,
gl_history.open);
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
@@ -121,6 +121,8 @@ bool global_history_init( void )
gl_history.tv = atari_treeview_create(history_global_get_tree_flags(),
gl_history.window, handle_event);
+ gemtk_wm_unlink(gl_history.window);
+
if (gl_history.tv == NULL) {
/* TODO: handle it properly, clean up previous allocs */
LOG(("Failed to allocate history treeview"));
diff --git a/atari/hotlist.c b/atari/hotlist.c
index ede5814..3684a9a 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -89,7 +89,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
break;
case WM_CLOSED:
- hotlist_destroy();
+ hotlist_close();
break;
default: break;
@@ -129,6 +129,7 @@ void hotlist_init(void)
}
wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
gemtk_wm_set_toolbar(hl.window, tree, 0, 0);
+ gemtk_wm_unlink(hl.window);
hl.tv = atari_treeview_create(
hotlist_get_tree_flags(),
hl.window,
@@ -181,7 +182,7 @@ void hotlist_close(void)
{
wind_close(gemtk_wm_get_handle(hl.window));
hl.open = false;
- atari_treeview_close( hl.tv );
+ atari_treeview_close(hl.tv);
}
void hotlist_destroy(void)
@@ -197,7 +198,7 @@ void hotlist_destroy(void)
wind_delete(gemtk_wm_get_handle(hl.window));
gemtk_wm_remove(hl.window);
hl.window = NULL;
- atari_treeview_destroy( hl.tv );
+ atari_treeview_destroy(hl.tv);
hl.init = false;
}
LOG(("done"));
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 2339cd6..8db7cc2 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -607,9 +607,10 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&c, (unsigned short*)&out );
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0]);
+ RGB1000 out;
+ rgb_to_vdi1000( (unsigned char*)&c, &out);
+ vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR,
+ (unsigned short*)&out);
#ifdef WITH_8BPP_SUPPORT
} else {
c = RGB_TO_VDI(c);
diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c
index 6e6e330..3db29eb 100644
--- a/atari/plot/font_internal.c
+++ b/atari/plot/font_internal.c
@@ -245,10 +245,18 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out
);
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
- plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
+ //unsigned short out[4];
+ RGB1000 out;
+ //rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned
short*)&out );
+ out.blue = 0;
+ out.green = 1000;
+ out.red = 0;
+ vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (short *)&out);
+ vq_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, 1, (short *)&out);
+ //printf("r:%d,g:%d,b:%d", out.red, out.green, out.blue);
+ //vsl_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR);
+ //vsf_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR);
+ plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS);
#ifdef WITH_8BPP_SUPPORT
} else {
unsigned char c = RGB_TO_VDI(fstyle->foreground);
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 89596b3..4ebab24 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -16,15 +16,20 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#ifdef WITH_VDI_FONT_DRIVER
+#ifdef WITH_VDI_FONT_DRIVER
+
+#include <mt_gemx.h>
+
#include "atari/plot/plot.h"
#include "atari/plot/font_vdi.h"
#include "utils/utf8.h"
-#include "utils/log.h"
+#include "utils/log.h"
+
-static char * lstr = NULL;
+
+//static char * lstr = NULL;
static int dtor( FONT_PLOTTER self );
@@ -39,6 +44,25 @@ static bool init = false;
static int vdih;
extern struct s_vdi_sysinfo vdi_sysinfo;
+
+static inline void atari_to_vdi_str(char *lstr, int length)
+{
+ int i, z;
+
+ for (i=z=0; i<length; ) {
+ if (((char)lstr[i]==(char)0xC2) && ((char)lstr[i+1] == (char)0xA0)) {
+ lstr[z] = ' ';
+ lstr[z+1] = ' ';
+ i=i+2;
+ z=z+2;
+ }
+ else {
+ lstr[z] = lstr[i];
+ i++;
+ z++;
+ }
+ }
+}
int ctor_font_plotter_vdi( FONT_PLOTTER self )
{
@@ -65,11 +89,15 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t
*fstyle, const c
{
short cw, ch, cellw, cellh;
short pxsize;
- short fx=0;
- lstr = (char*)str;
- utf8_to_enc(str, "ATARIST", length, &lstr );
+ short fx=0;
+ char * lstr = NULL;
+
+ utf8_to_local_encoding(str, length, &lstr);
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr);
+
+
+ atari_to_vdi_str(lstr, slen);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -79,11 +107,19 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t
*fstyle, const c
fx |= 1;
vst_effects( self->vdi_handle, fx );
/* TODO: replace 90 with global dpi setting */
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+/*
+ if(slen != utf8_bounded_length(str, length)){
+ printf("sl: %d, utl: %d\n ", slen, utf8_bounded_length(str, length));
+ printf("s: %s // %s\n", str, lstr );
+ }*/
+
+
*width = slen * cellw;
- free( (void*)lstr );
- lstr = NULL;
+ free((void*)lstr);
return( 0 );
}
@@ -94,15 +130,19 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *
fstyle, const
short pxsize;
short fx=0;
int i;
- lstr = (char*)string;
- int slen = 0;
+ char *lstr = NULL;
+ size_t slen = 0;
int last_space_x = 0;
- int last_space_idx = 0;
+ int last_space_idx = 0;
+ size_t nxtchr = 0;
- utf8_to_enc(string, "ATARIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
+ slen = strlen(lstr);
+
+
+ atari_to_vdi_str(lstr, slen);
- slen = strlen(lstr);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
@@ -110,27 +150,50 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *
fstyle, const
if( fstyle->weight > 450 )
fx |= 1;
vst_effects( self->vdi_handle, fx );
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+
+ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
*actual_x = 0;
- *char_offset = 0;
- int cpos=0;
- for( i=0; i<slen; i++) {
- if( lstr[i] == ' ' ) {
+ //*char_offset = 0;
+ int cpos=0;
+ while (nxtchr < slen) {
+ if( lstr[nxtchr] == ' ' ) {
last_space_x = *actual_x;
- last_space_idx = cpos;
- }
- if( *actual_x > x ) {
- *actual_x = last_space_x;
- *char_offset = last_space_idx;
- return true;
- }
- *actual_x += cellw;
- cpos++;
- }
- *char_offset = cpos;
+ last_space_idx = nxtchr;
+ }
+ *actual_x += cellw;
+ if (*actual_x > x) {
+ *actual_x = last_space_x;
+ *char_offset = last_space_idx;
+ //printf("at: %s\n", lstr);
+ return(0);
+ }
+
+ nxtchr++;
+ }
+ if(nxtchr >= length){
+ nxtchr = length-1;
+ }
+
+ *char_offset = nxtchr;
+
+// for( i=0; i<slen; i++) {
+// if( lstr[i] == ' ' ) {
+// last_space_x = *actual_x;
+// last_space_idx = cpos;
+// }
+// if( *actual_x > x ) {
+// *actual_x = last_space_x;
+// *char_offset = last_space_idx;
+// return true;
+// }
+// *actual_x += cellw;
+// cpos++;
+// }
+// *char_offset = cpos;
free( (void*)lstr );
- lstr = NULL;
return( 0 );
}
@@ -141,19 +204,22 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *
fstyle,const
short pxsize=0;
short fx=0;
- lstr = (char*)string;
+ char *lstr = NULL;
int i=0;
int curpx=0;
- utf8_to_enc(string, "ATRIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr);
+
+ atari_to_vdi_str(lstr, slen);
+
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
- vst_effects( self->vdi_handle, fx );
+ vst_effects(self->vdi_handle, fx);
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
*actual_x = 0;
@@ -166,24 +232,30 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *
fstyle,const
break;
}
}
- free( (void*)lstr );
+ free((void*)lstr);
lstr = NULL;
return( 0 );
}
static inline void vst_rgbcolor( short vdih, uint32_t cin )
{
- if( vdi_sysinfo.scr_bpp > 8 ) {
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
- vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] );
+#ifdef WITH_8BPP_SUPPORT
+ if( vdi_sysinfo.scr_bpp > 8 ) {
+#endif
+ //unsigned short c[4];
+ RGB1000 c;
+
+ rgb_to_vdi1000( (unsigned char*)&cin, &c );
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vst_color( vdih, OFFSET_CUSTOM_COLOR );
+#ifdef WITH_8BPP_SUPPORT
} else {
if( vdi_sysinfo.scr_bpp >= 4 )
vst_color( vdih, RGB_TO_VDI(cin) );
else
vst_color( vdih, BLACK );
- }
+ }
+#endif
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
@@ -192,16 +264,20 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
/* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */
short cw, ch, cellw, cellh;
short pxsize=8;
- short fx=0;
- lstr = (char*)text;
- utf8_to_enc(text, "ATARIST", length, &lstr );
- assert( lstr != NULL );
- int slen = strlen(lstr);
- size_t mylen = MIN(511, slen );
- char textcpy[mylen+1];
+ short fx=0;
+ GRECT canvas;
+ char *lstr = NULL;
+ assert( utf8_to_local_encoding(text, length, &lstr) == UTF8_CONVERT_OK);
+ assert( lstr != NULL );
+
+ int slen = strlen(lstr);
+ if(slen > 800){
+ lstr[800]=0;
+ }
+
+
+ atari_to_vdi_str(lstr, slen);
- textcpy[mylen] = 0;
- strncpy((char*)&textcpy, lstr, mylen+1 );
if( fstyle != NULL){
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -212,20 +288,25 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss),
use that value or pass it as arg, to reduce netsurf dependency */
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- }
- x += CURFB(self->plotter).x;
- y += CURFB(self->plotter).y;
+ }
+ plot_get_dimensions(&canvas);
+ x += canvas.g_x;
+ y += canvas.g_y;
vst_effects( self->vdi_handle, fx );
- vst_alignment(vdih, 0, 4, &cw, &ch );
- vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ vst_alignment(vdih, 0, 0, &cw, &ch );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ //vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
vswr_mode( self->vdi_handle, MD_TRANS );
- vst_rgbcolor(self->vdi_handle, fstyle->foreground );
+ vst_rgbcolor(self->vdi_handle, fstyle->foreground);
- if( atari_sysinfo.gdos_FSMC ){
- v_ftext( self->vdi_handle, x, y, (char*)&textcpy );
- } else {
- v_gtext( self->vdi_handle, x, y, (char*)&textcpy );
+ if( atari_sysinfo.gdos_FSMC ){
+ //printf("\nftext\n");
+ v_ftext( self->vdi_handle, x, y, (char*)lstr );
+ } else {
+ //printf("\ngtext\n");
+ v_gtext( self->vdi_handle, x, y, (char*)lstr );
}
free( lstr );
return( 0 );
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index eb44e47..2a8fd68 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -193,9 +193,10 @@ inline static void vsl_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c);
- vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0]);
+ //unsigned short c[4];
+ RGB1000 c;
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vsl_color(vdih, OFFSET_CUSTOM_COLOR);
#ifdef WITH_8BPP_SUPPORT
} else {
@@ -219,9 +220,9 @@ inline static void vsf_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
- vs_color( vdih, OFFSET_CUSTOM_COLOR, &c[0] );
+ RGB1000 c;
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vsf_color( vdih, OFFSET_CUSTOM_COLOR );
#ifdef WITH_8BPP_SUPPORT
} else {
@@ -512,14 +513,14 @@ static struct s_vdi_sysinfo * read_vdi_sysinfo(short vdih, struct
s_vdi_sysinfo
/*
Convert an RGB color to an VDI Color
*/
-inline void rgb_to_vdi1000(unsigned char * in, unsigned short * out)
+inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out)
{
double r = ((double)in[3]/255); /* prozentsatz red */
double g = ((double)in[2]/255); /* prozentsatz green */
double b = ((double)in[1]/255); /* prozentsatz blue */
- out[0] = 1000 * r + 0.5;
- out[1] = 1000 * g + 0.5;
- out[2] = 1000 * b + 0.5;
+ out->red = 1000 * r + 0.5;
+ out->green = 1000 * g + 0.5;
+ out->blue = 1000 * b + 0.5;
return;
}
@@ -1441,14 +1442,14 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
return(true);
}
-bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor,
+bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
uint32_t flags)
{
MFDB screen, tran;
MFDB * src;
short pxy[8];
- short c[2] = {fgcolor, G_WHITE};
+ short c[2] = {fgcolor, 0};
GRECT off;
plot_get_clip_grect(&off);
@@ -1457,29 +1458,30 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char
fgcolor,
}
init_mfdb( 0, loc->g_w, loc->g_h, 0, &screen );
-
- if( insrc->fd_stand ){
- int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h,
- MFDB_FLAG_NOALLOC,
- &tran
- );
- if( size_buf_scr == 0 ){
- buf_scr.fd_addr = malloc( size );
- size_buf_scr = size;
- } else {
- if( size > size_buf_scr ) {
- buf_scr.fd_addr = realloc(
- buf_scr.fd_addr, size
- );
- size_buf_scr = size;
- }
- }
- tran.fd_addr = buf_scr.fd_addr;
- vr_trnfm(atari_plot_vdi_handle, insrc, &tran );
- src = &tran;
- } else {
+//
+// if( insrc->fd_stand){
+// printf("st\n");
+// int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h,
+// MFDB_FLAG_NOALLOC,
+// &tran
+// );
+// if( size_buf_scr == 0 ){
+// buf_scr.fd_addr = malloc( size );
+// size_buf_scr = size;
+// } else {
+// if( size > size_buf_scr ) {
+// buf_scr.fd_addr = realloc(
+// buf_scr.fd_addr, size
+// );
+// size_buf_scr = size;
+// }
+// }
+// tran.fd_addr = buf_scr.fd_addr;
+// vr_trnfm(atari_plot_vdi_handle, insrc, &tran );
+// src = &tran;
+// } else {
src = insrc;
- }
+// }
pxy[0] = off.g_x - loc->g_x;
pxy[1] = off.g_y - loc->g_y;
@@ -1492,7 +1494,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char
fgcolor,
if( flags & PLOT_FLAG_TRANS && src->fd_nplanes == 1){
- vrt_cpyfm(atari_plot_vdi_handle, MD_TRANS, (short*)pxy, src, &screen,
(short*)&c );
+ vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen,
(short*)&c);
} else {
/* this method only plots transparent bitmaps, right now... */
}
diff --git a/atari/plot/plot.h b/atari/plot/plot.h
index df34be4..b0ec58b 100755
--- a/atari/plot/plot.h
+++ b/atari/plot/plot.h
@@ -115,7 +115,7 @@ bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t
*style );
bool plot_line( int x0, int y0, int x1, int y1, const plot_style_t *style );
bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags);
-bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor,
+bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
uint32_t flags);
bool plot_copy_rect(GRECT src, GRECT dst);
@@ -123,7 +123,7 @@ bool plot_copy_rect(GRECT src, GRECT dst);
void vdi1000_to_rgb( unsigned short * in, unsigned char * out );
/* convert an bgra color to vdi1000 color */
-void rgb_to_vdi1000( unsigned char * in, unsigned short * out );
+void rgb_to_vdi1000( unsigned char * in, RGB1000 *out);
/* convert an rgb color to an index into the web palette */
short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b);
diff --git a/atari/rootwin.c b/atari/rootwin.c
index a0d773f..45f5568 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -96,12 +96,13 @@ static const struct redraw_context rootwin_rdrw_ctx = {
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
- GRECT content_area;
+ GRECT area;
static bool prev_url = false;
static short prev_x=0;
static short prev_y=0;
struct rootwin_data_s * data = gemtk_wm_get_user_data(win);
struct gui_window *tmp;
+ OBJECT *obj;
if ((ev_out->emo_events & MU_MESAG) != 0) {
@@ -177,9 +178,9 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
}
if ((ev_out->emo_events & MU_BUTTON) != 0) {
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
- &content_area);
+ &area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
- content_area)) {
+ area)) {
on_content_mouse_click(data->rootwin);
}
}
@@ -191,10 +192,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
// The window found at x,y is an gui_window
// and it's the input window.
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
- &content_area);
+ &area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
- content_area)) {
- on_content_mouse_move(data->rootwin, &content_area);
+ area)) {
+ on_content_mouse_move(data->rootwin, &area);
} else {
GRECT tb_area;
window_get_grect(data->rootwin, BROWSER_AREA_URL_INPUT,
&tb_area);
@@ -1303,18 +1304,20 @@ static short on_window_key_input(ROOTWIN *rootwin, unsigned short
nkc)
/* make sure we report for the root window and report...: */
done = toolbar_key_input(gw->root->toolbar, nkc);
} else {
- gw_tmp = window_list;
- /* search for active browser component: */
- while( gw_tmp != NULL && done == false ) {
- /* todo: only handle when input_window == ontop */
- if( window_widget_has_focus(input_window->root, BROWSER,
- (void*)gw_tmp->browser)) {
- done = on_content_keypress(gw_tmp->browser->bw, nkc);
- break;
- } else {
- gw_tmp = gw_tmp->next;
- }
- }
+ if( window_widget_has_focus(input_window->root, BROWSER,
+ (void*)input_window->browser)) {
+ done = on_content_keypress(input_window->browser->bw, nkc);
+ }
+ else if(window_widget_has_focus(input_window->root, SEARCH_INPUT, NULL)) {
+ OBJECT * obj;
+ obj = toolbar_get_form(input_window->root->toolbar);
+ obj[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED;
+ obj[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED;
+ window_schedule_redraw_grect(input_window->root,
+ gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_FWD));
+ window_schedule_redraw_grect(input_window->root,
+ gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_BACK));
+ }
}
return((done==true) ? 1 : 0);
}
diff --git a/atari/settings.c b/atari/settings.c
index d46de47..4f73fc3 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -691,7 +691,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
}
break;
- case GEMTK_WM_WM_FORM:
+ case GEMTK_WM_WM_FORM_CLICK:
form_event(msg[4], 1);
break;
diff --git a/atari/toolbar.c b/atari/toolbar.c
index c81c969..56d3b04 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -653,17 +653,17 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text)
bool toolbar_key_input(struct s_toolbar *tb, short nkc)
{
- assert(tb!=NULL);
- GRECT work;
+ assert(tb!=NULL);
+
+ GRECT work;
bool ret = false;
-
struct gui_window *gw = window_get_active_gui_window(tb->owner);
assert( gw != NULL );
long ucs4;
long ik = nkc_to_input_key(nkc, &ucs4);
-
+
if (ik == 0) {
if ((nkc&0xFF) >= 9) {
ret = textarea_keypress(tb->url.textarea, ucs4);
diff --git a/atari/treeview.c b/atari/treeview.c
index 8d5520e..0aedb4c 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -292,14 +292,17 @@ NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
void atari_treeview_open( NSTREEVIEW tv )
{
if( tv->window != NULL ) {
+ gemtk_wm_link(tv->window);
tree_set_redraw(tv->tree, true);
+
}
}
-void atari_treeview_close( NSTREEVIEW tv )
+void atari_treeview_close(NSTREEVIEW tv)
{
- if( tv->window != NULL ) {
+ if(tv->window != NULL) {
tree_set_redraw(tv->tree, false);
+ gemtk_wm_unlink(tv->window);
}
}
@@ -340,7 +343,7 @@ bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms,
int x, int y
-void atari_treeview_redraw( NSTREEVIEW tv)
+void atari_treeview_redraw(NSTREEVIEW tv)
{
if (tv != NULL) {
if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/577ff3cffc5fb99041c...
commit 577ff3cffc5fb99041c5da2d828b1f25cfb13dc9
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
The Window toolbar now have independet AES objects,
which means no state restore is required before redraw.
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 1fb1426..e187aea 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -171,8 +171,7 @@ enum guwin_area_e {
short
gemtk_wm_init(void);
-void
-gemtk_wm_exit(void);
+void gemtk_wm_exit(void);
GUIWIN * gemtk_wm_add(short handle, uint32_t flags,
gemtk_wm_event_handler_f handler);
@@ -210,6 +209,8 @@ void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index);
void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s);
+void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn);
+
void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func);
bool gemtk_wm_update_slider(GUIWIN *win, short mode);
@@ -248,4 +249,5 @@ GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj);
bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area);
OBJECT *gemtk_obj_get_tree(int idx);
void gemtk_obj_mouse_sprite(OBJECT *tree, int index);
+OBJECT *gemtk_obj_tree_copy(OBJECT *tree);
#endif // GEMTK_H_INCLUDED
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 9dc3868..95e9b08 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -476,17 +476,8 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
if (next_edit_obj != gw->toolbar_edit_obj) {
- if(gw->toolbar_edit_obj != -1) {
- objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
- ev_out->emo_kreturn, &edit_idx,
- EDEND, gw->handle);
- }
-
- gw->toolbar_edit_obj = next_edit_obj;
-
- objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
- ev_out->emo_kreturn, &edit_idx,
- EDINIT, gw->handle);
+ gemtk_wm_set_toolbar_edit_obj(gw, next_edit_obj,
+ ev_out->emo_kreturn);
} else {
if(next_char > 13)
r = objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
@@ -999,6 +990,25 @@ void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s)
win->toolbar_size = s;
}
+/** Set the current active edit object */
+void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn)
+{
+ short edit_idx;
+
+ if (obj != win->toolbar_edit_obj) {
+
+ if(win->toolbar_edit_obj != -1) {
+ objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx,
+ EDEND, win->handle);
+ }
+
+ win->toolbar_edit_obj = obj;
+
+ objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx,
+ EDINIT, win->handle);
+ }
+}
+
/** Set an custom toolbar redraw function which is called instead of
* default drawing routine.
* \param win the GUIWIN
diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c
index 2558694..2a5eaae 100644
--- a/atari/gemtk/objc.c
+++ b/atari/gemtk/objc.c
@@ -1,127 +1,127 @@
-/*
- * Copyright 2013 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf,
http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <
http://www.gnu.org/licenses/>.
- *
- * Module Description:
- *
- * AES Object tree tools.
- *
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ *
+ * Module Description:
+ *
+ * AES Object tree tools.
+ *
*/
#include <assert.h>
- #include "gemtk.h"
+#include "gemtk.h"
char *gemtk_obj_get_text(OBJECT * tree, short idx)
{
- static char p[]="";
- USERBLK *user;
- char *retval;
-
- switch (tree[idx].ob_type & 0x00FF) {
- case G_BUTTON:
- case G_STRING:
- case G_TITLE:
- return( tree[idx].ob_spec.free_string);
- case G_TEXT:
- case G_BOXTEXT:
- case G_FTEXT:
- case G_FBOXTEXT:
- return (tree[idx].ob_spec.tedinfo->te_ptext);
- case G_ICON:
- case G_CICON:
- return (tree[idx].ob_spec.iconblk->ib_ptext);
- break;
-
- default: break;
- }
- return (p);
+ static char p[]="";
+ USERBLK *user;
+ char *retval;
+
+ switch (tree[idx].ob_type & 0x00FF) {
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+ return( tree[idx].ob_spec.free_string);
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+ return (tree[idx].ob_spec.tedinfo->te_ptext);
+ case G_ICON:
+ case G_CICON:
+ return (tree[idx].ob_spec.iconblk->ib_ptext);
+ break;
+
+ default:
+ break;
+ }
+ return (p);
}
-static void set_text(OBJECT *obj, short idx, char * text, int len)
-{
- char spare[255];
-
- if( len > 254 )
- len = 254;
- if( text != NULL ){
- strncpy(spare, text, 254);
- } else {
- strcpy(spare, "");
- }
-
- set_string(obj, idx, spare);
+static void set_text(OBJECT *obj, short idx, char * text, int len)
+{
+ char spare[255];
+
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ) {
+ strncpy(spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ }
+
+ set_string(obj, idx, spare);
}
char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt)
{
- char spare[204];
- short type = 0;
- short maxlen = 0;
- TEDINFO *ted;
-
-
- type = (tree[idx].ob_type & 0xFF);
- if (type == G_FTEXT || type == G_FBOXTEXT) {
- TEDINFO *ted = ((TEDINFO *)get_obspec(tree, idx));
- maxlen = ted->te_txtlen+1;
- if (maxlen > 200) {
- maxlen = 200;
- }
- else if (maxlen < 0) {
- maxlen = 0;
- }
- } else {
- assert((type == G_FTEXT) || (type == G_FBOXTEXT));
- }
-
- snprintf(spare, maxlen, "%s", txt);
- set_string(tree, idx, spare);
+ char spare[204];
+ short type = 0;
+ short maxlen = 0;
+ TEDINFO *ted;
+
+
+ type = (tree[idx].ob_type & 0xFF);
+ if (type == G_FTEXT || type == G_FBOXTEXT) {
+ TEDINFO *ted = ((TEDINFO *)get_obspec(tree, idx));
+ maxlen = ted->te_txtlen+1;
+ if (maxlen > 200) {
+ maxlen = 200;
+ } else if (maxlen < 0) {
+ maxlen = 0;
+ }
+ } else {
+ assert((type == G_FTEXT) || (type == G_FBOXTEXT));
+ }
+
+ snprintf(spare, maxlen, "%s", txt);
+ set_string(tree, idx, spare);
}
OBJECT *gemtk_obj_get_tree(int idx)
-{
+{
+
+ OBJECT *tree;
- OBJECT *tree;
-
- rsrc_gaddr(R_TREE, idx, &tree);
-
- return tree;
+ rsrc_gaddr(R_TREE, idx, &tree);
+
+ return tree;
}
bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area)
{
- GRECT obj_screen;
- bool ret = false;
+ GRECT obj_screen;
+ bool ret = false;
- objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
- obj_screen.g_w = tree[obj].ob_width;
- obj_screen.g_h = tree[obj].ob_height;
+ objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
+ obj_screen.g_w = tree[obj].ob_width;
+ obj_screen.g_h = tree[obj].ob_height;
- ret = RC_WITHIN(&obj_screen, area);
+ ret = RC_WITHIN(&obj_screen, area);
- return(ret);
+ return(ret);
}
GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj)
{
- static GRECT obj_screen;
+ static GRECT obj_screen;
- get_objframe(tree, obj, &obj_screen);
+ get_objframe(tree, obj, &obj_screen);
- return(&obj_screen);
+ return(&obj_screen);
}
@@ -146,3 +146,223 @@ void gemtk_obj_mouse_sprite(OBJECT *tree, int index)
}
graf_mouse(USER_DEF, &mform);
}
+
+
+/*
+ * gemtk_obj_tree_copy
+ *
+ * Copy a complete object-tree including all substructures (optional).
+ *
+ * CAUTION: The object-tree *must* have the LASTOB-flag (0x20) set in
+ * it's physically last member.
+ *
+ * BUG: Up to now tree_copy won't copy the color-icon-structure,
+ * because I'm too lazy ;) Maybe I'll do that one day. If you need it
+ * urgently, contact me and force me to work... Btw, this doesn't mean
+ * that G_CICONs won't be copied at all, but the copied tree will
+ * share the CICONBLKs with the original.
+ *
+ * Input:
+ * tree: Pointer to tree which should be copied
+ * what: Specifies what substructures should be copied, too (see the
+ * C_xxx-definitions in tree-copy.h for details)
+ *
+ * Output:
+ * NULL: Tree couldn't be copied (due to lack of memory)
+ * otherwise: Pointer to copied tree, use free to dealloc it's memory
+ */
+OBJECT *gemtk_obj_tree_copy(OBJECT *tree)
+{
+ int16_t i, objects;
+ size_t to_malloc, size;
+ OBJECT *new_tree;
+ char *area;
+
+ /* Calculate the number of bytes we need for the new tree */
+ to_malloc = (size_t) 0;
+ for (i = 0;;) {
+
+ /* Size of the OBJECT-structure itself */
+ to_malloc += sizeof(OBJECT);
+
+ switch (tree[i].ob_type & 0xff) {
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+ /* Size of a TEDINFO-structure */
+ to_malloc += sizeof(TEDINFO);
+
+ /* Sizes of the strings in the TEDINFO-structure */
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen;
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen;
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_tmplen;
+ break;
+
+ case G_IMAGE:
+
+ /* Size of the BITBLK-structure */
+ to_malloc += sizeof(BITBLK);
+
+ /* Size of the image-data in the BITBLK-structure */
+ to_malloc += (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb *
+ (int32_t)tree[i].ob_spec.bitblk->bi_hl);
+
+ break;
+
+ case G_USERDEF:
+ /* Size of the USERBLK-structure */
+ to_malloc += sizeof(USERBLK);
+ break;
+
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+ /* Size of the string (with one null character at the end) */
+ to_malloc += strlen(tree[i].ob_spec.free_string) + 1L;
+ break;
+
+ case G_ICON:
+ /* Size of the ICONBLK-structure */
+ to_malloc += sizeof(BITBLK);
+
+ /* Sizes of icon-data, icon-mask and icon-text */
+ to_malloc += (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon *
+ (int32_t)tree[i].ob_spec.iconblk->ib_hicon /
+ 4L + 1L +
+ (int32_t)strlen(tree[i].ob_spec.iconblk->ib_ptext));
+
+ break;
+ }
+
+ /* If the size is odd, make it even */
+ if ((long)to_malloc & 1)
+ to_malloc++;
+
+ /* Exit if we've reached the last object in the tree */
+ if (tree[i].ob_flags & OF_LASTOB)
+ break;
+
+ i++;
+ }
+
+ objects = i + 1;
+
+ /* If there's not enough memory left for the new tree, return NULL */
+ if ((new_tree = (OBJECT *)calloc(1, to_malloc)) == NULL) {
+ return(NULL);
+ }
+
+ /*
+ * area contains a pointer to the area where we copy the structures to
+ */
+ area = (char *)((int32_t)new_tree+(int32_t)objects*(int32_t)sizeof(OBJECT));
+
+ for (i = 0; i < objects; i++) {
+
+ /* Copy the contents of the OBJECT-structure */
+ new_tree[i] = tree[i];
+
+ /* This was added to assure true copies of the object type */
+ new_tree[i].ob_type = tree[i].ob_type;
+
+ switch (tree[i].ob_type & 0xff) {
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+
+ /* Copy the contents of the TEDINFO-structure */
+ *(TEDINFO *)area = *tree[i].ob_spec.tedinfo;
+ new_tree[i].ob_spec.tedinfo = (TEDINFO *)area;
+ area += sizeof(TEDINFO);
+
+ /* Copy the strings in the TEDINFO-structure */
+ strncpy(area, tree[i].ob_spec.tedinfo->te_ptext,
+ tree[i].ob_spec.tedinfo->te_txtlen);
+ new_tree[i].ob_spec.tedinfo->te_ptext = area;
+ area += tree[i].ob_spec.tedinfo->te_txtlen;
+ strncpy(area, tree[i].ob_spec.tedinfo->te_ptmplt,
+ tree[i].ob_spec.tedinfo->te_tmplen);
+ new_tree[i].ob_spec.tedinfo->te_ptmplt = area;
+ area += tree[i].ob_spec.tedinfo->te_tmplen;
+ strncpy(area, tree[i].ob_spec.tedinfo->te_pvalid,
+ tree[i].ob_spec.tedinfo->te_txtlen);
+ new_tree[i].ob_spec.tedinfo->te_pvalid = area;
+ area += tree[i].ob_spec.tedinfo->te_txtlen;
+
+ break;
+
+ case G_IMAGE:
+
+ /* Copy the contents of the BITBLK-structure */
+ *(BITBLK *)area = *tree[i].ob_spec.bitblk;
+ new_tree[i].ob_spec.bitblk = (BITBLK *)area;
+ area += sizeof(BITBLK);
+
+ /* Copy the image-data */
+ size = (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb *
+ (int32_t)tree[i].ob_spec.bitblk->bi_hl);
+ memcpy(area, tree[i].ob_spec.bitblk->bi_pdata, size);
+ new_tree[i].ob_spec.bitblk->bi_pdata = (int16_t *)area;
+ area += size;
+
+ break;
+
+ case G_USERDEF:
+
+ /* Copy the contents of the USERBLK-structure */
+ *(USERBLK *)area = *tree[i].ob_spec.userblk;
+ new_tree[i].ob_spec.userblk = (USERBLK *)area;
+ area += sizeof(USERBLK);
+
+ break;
+
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+
+ /* Copy the string */
+ size = strlen(tree[i].ob_spec.free_string) + 1L;
+ strcpy(area, tree[i].ob_spec.free_string);
+ new_tree[i].ob_spec.free_string = area;
+ area += size;
+
+ break;
+
+ case G_ICON:
+
+ /* Copy the contents of the ICONBLK-structure */
+ *(ICONBLK *)area = *tree[i].ob_spec.iconblk;
+ new_tree[i].ob_spec.iconblk = (ICONBLK *)area;
+ area += sizeof(ICONBLK);
+
+ size = (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon *
+ (int32_t)tree[i].ob_spec.iconblk->ib_hicon /
+ 8L);
+ /* Copy the mask-data */
+ memcpy(area, tree[i].ob_spec.iconblk->ib_pmask, size);
+ new_tree[i].ob_spec.iconblk->ib_pmask = (int16_t *)area;
+ area += size;
+
+ /* Copy the icon-data */
+ memcpy(area, tree[i].ob_spec.iconblk->ib_pdata, size);
+ new_tree[i].ob_spec.iconblk->ib_pdata = (int16_t *)area;
+ area += size;
+ size = strlen(tree[i].ob_spec.iconblk->ib_ptext) + 1L;
+
+ /* Copy the icon-string */
+ strcpy(area, tree[i].ob_spec.iconblk->ib_ptext);
+ new_tree[i].ob_spec.iconblk->ib_ptext = area;
+ area += size;
+
+ break;
+ }
+
+ /* Assure that area contains an even address */
+ if ((int32_t)area & 1)
+ area++;
+ }
+
+ return(new_tree);
+}
diff --git a/atari/gui.h b/atari/gui.h
index c114384..fef686a 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -75,6 +75,7 @@ struct s_gem_cursors {
enum focus_element_type {
WIDGET_NONE=0,
URL_WIDGET,
+ SEARCH_INPUT,
BROWSER
};
diff --git a/atari/rootwin.c b/atari/rootwin.c
index 44eec33..a0d773f 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -139,7 +139,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case WM_UNICONIFY:
LOG(("WM_TOPPED"));
gui_set_input_gui_window(data->rootwin->active_gui_window);
- window_restore_active_gui_window(data->rootwin);
+ //window_restore_active_gui_window(data->rootwin);
// TODO: use something like "restore_active_gui_window_state()"
break;
@@ -275,7 +275,7 @@ int window_create(struct gui_window * gw,
if(tb) {
gw->root->toolbar = toolbar_create(gw->root);
assert(gw->root->toolbar);
- gemtk_wm_set_toolbar(gw->root->win, gemtk_obj_get_tree(TOOLBAR), 0, 0);
+ gemtk_wm_set_toolbar(gw->root->win, gw->root->toolbar->form, 0,
0);
gemtk_wm_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb);
} else {
gw->root->toolbar = NULL;
@@ -415,10 +415,7 @@ void window_restore_active_gui_window(ROOTWIN *rootwin)
window_set_title(rootwin, gw->title);
if (gw->search != NULL) {
- nsatari_search_restore_form(gw->search, gemtk_obj_get_tree(TOOLBAR));
- window_open_search(rootwin, false);
- } else {
- toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
+ // TODO: update search session (especially browser window)
}
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
@@ -509,21 +506,26 @@ void window_set_focus(struct s_gui_win_root *rootwin,
LOG(("Set focus: %p (%d)\n", element, type));
rootwin->focus.type = type;
rootwin->focus.element = element;
- if( element != NULL ) {
- switch( type ) {
+ switch( type ) {
- case URL_WIDGET:
+ case URL_WIDGET:
// TODO: make something like: toolbar_text_select_all();
- ta = toolbar_get_textarea(rootwin->toolbar,
- URL_INPUT_TEXT_AREA);
- textarea_keypress(ta, KEY_SELECT_ALL);
- break;
+ toolbar_key_input(rootwin->toolbar, (short)(NKF_CTRL | 'A') );
+/*
+ ta = toolbar_get_textarea(rootwin->toolbar,
+ URL_INPUT_TEXT_AREA);
+ textarea_keypress(ta, KEY_SELECT_ALL);
+ */
+ break;
- default:
- break;
+ case SEARCH_INPUT:
+ gemtk_wm_set_toolbar_edit_obj(rootwin->win, TOOLBAR_TB_SRCH, 0);
+ break;
- }
- }
+ default:
+ break;
+
+ }
}
}
@@ -584,7 +586,8 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window
*gw)
}
}
-struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin) {
+struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin)
+{
return(rootwin->active_gui_window);
}
@@ -652,20 +655,12 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
struct gui_window *gw;
GRECT area;
OBJECT *obj;
- static bool init = false;
LOG((""));
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
- obj = gemtk_obj_get_tree(TOOLBAR);
-
- if (init == false) {
- obj[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
- obj[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
- gemtk_obj_set_str_safe(obj, TOOLBAR_TB_SRCH, (char*)"");
- init = true;
- }
+ obj = toolbar_get_form(rootwin->toolbar);
if (gw->search == NULL) {
gw->search = nsatari_search_session_create(obj, bw);
@@ -676,6 +671,9 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
window_get_grect(rootwin, BROWSER_AREA_SEARCH, &area);
window_schedule_redraw_grect(rootwin, &area);
+ window_process_redraws(rootwin);
+ window_set_focus(rootwin, SEARCH_INPUT, NULL);
+
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
if (reformat) {
browser_window_reformat(bw, false, area.g_w, area.g_h);
@@ -699,8 +697,6 @@ void window_close_search(ROOTWIN *rootwin)
gw->search = NULL;
}
- obj[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED;
-
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area);
gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
diff --git a/atari/search.c b/atari/search.c
index 0246250..17241d1 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -39,6 +39,7 @@
#include "atari/gui.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
+#include "atari/toolbar.h"
#include "atari/search.h"
#include "atari/gemtk/gemtk.h"
#include "atari/res/netsurf.rsh"
@@ -110,11 +111,24 @@ void nsatari_search_add_recent(const char *string, void *p)
*/
void nsatari_search_set_forward_state(bool active, void *p)
-{
+{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set forward state: %d\n", p, active));
- // TODO: update gui
+
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
+
}
/**
@@ -125,12 +139,23 @@ void nsatari_search_set_forward_state(bool active, void *p)
void nsatari_search_set_back_state(bool active, void *p)
{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set back state: %d\n", p, active));
- s->state.back_avail = true;
- // TODO: update gui
+ s->state.back_avail = active;
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
}
@@ -204,7 +229,7 @@ void nsatari_search_session_destroy(struct s_search_form_session *s)
}
}
-/* checks for search parameters changes */
+/** checks for search parameters changes */
static bool search_session_compare(struct s_search_form_session *s, OBJECT *obj)
{
bool check;
@@ -240,10 +265,11 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT
*obj,
bool fwd;
search_flags_t flags = f;
- assert(s!=null);
+ assert(s!=null);
+ assert(input_window->browser->bw == s->bw);
+
if(search_session_compare(s, obj)){
- printf("reset search form\n");
browser_window_search_destroy_context(s->bw);
apply_form(obj, &s->state);
} else {
diff --git a/atari/toolbar.c b/atari/toolbar.c
index a4a1ed3..c81c969 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -239,6 +239,12 @@ void toolbar_init( void )
userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk;
+ aes_toolbar[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
+ aes_toolbar[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
+
+ /* init default values: */
+ gemtk_obj_set_str_safe(aes_toolbar, TOOLBAR_TB_SRCH, (char*)"");
+
area_full_height = aes_toolbar->ob_height;
area_search_height = aes_toolbar[TOOLBAR_AREA_SEARCH].ob_height;
area_navigation_height = aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_height;
@@ -272,7 +278,11 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
t->style = 1;
t->search_visible = false;
t->visible = true;
- t->reflow = true;
+ t->reflow = true;
+
+ /* dublicate the form template: */
+ t->form = gemtk_obj_tree_copy(aes_toolbar);
+
/* count buttons and add them as components: */
i = 0;
@@ -309,7 +319,10 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
void toolbar_destroy(struct s_toolbar *tb)
{
free(tb->buttons);
+ free(tb->form);
+
textarea_destroy(tb->url.textarea);
+
free(tb);
}
@@ -335,56 +348,56 @@ static void toolbar_reflow(struct s_toolbar *tb)
int i;
// position toolbar areas:
- aes_toolbar->ob_x = tb->area.g_x;
- aes_toolbar->ob_y = tb->area.g_y;
- aes_toolbar->ob_width = tb->area.g_w;
- aes_toolbar->ob_height = toolbar_calculate_height(tb);
+ tb->form->ob_x = tb->area.g_x;
+ tb->form->ob_y = tb->area.g_y;
+ tb->form->ob_width = tb->area.g_w;
+ tb->form->ob_height = toolbar_calculate_height(tb);
// expand the "main" areas to the current width:
- aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w;
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w;
+ tb->form[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w;
if (tb->search_visible) {
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
} else {
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
}
// align the throbber area at right edge:
- aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w
- - aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width;
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_THROBBER_AREA].ob_width;
// align the search button:
- aes_toolbar[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w
- - aes_toolbar[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
+ tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
// center the URL area:
- aes_toolbar[TOOLBAR_AREA_URL].ob_width = tb->area.g_w
- - (aes_toolbar[TOOLBAR_AREA_BUTTONS].ob_width
- + aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width + 1);
+ tb->form[TOOLBAR_AREA_URL].ob_width = tb->area.g_w
+ - (tb->form[TOOLBAR_AREA_BUTTONS].ob_width
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_width + 1);
// position throbber image:
throbber_form[tb->throbber.index].ob_x = tb->area.g_x +
- aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x;
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x;
throbber_form[tb->throbber.index].ob_x = tb->area.g_x
- + aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x +
- ((aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_x +
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_width
- throbber_form[tb->throbber.index].ob_width) >> 1);
throbber_form[tb->throbber.index].ob_y = tb->area.g_y +
- ((aes_toolbar[TOOLBAR_THROBBER_AREA].ob_height
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_height
- throbber_form[tb->throbber.index].ob_height) >> 1);
// set button states:
for (i=0; i < tb->btcnt; i++ ) {
if (tb->buttons[i].state == button_off) {
- aes_toolbar[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED;
+ tb->form[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED;
}
else if (tb->buttons[i].state == button_on) {
- aes_toolbar[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED;
+ tb->form[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED;
}
}
tb->reflow = false;
@@ -406,7 +419,7 @@ void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
//dbg_grect("toolbar redraw clip", clip);
- objc_draw_grect(aes_toolbar,0,8,clip);
+ objc_draw_grect(tb->form,0,8,clip);
objc_draw_grect(&throbber_form[tb->throbber.index], 0, 1, clip);
toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area_ro);
@@ -509,8 +522,8 @@ void toolbar_set_width(struct s_toolbar *tb, short w)
toolbar_reflow(tb);
/* this will request an textarea redraw: */
textarea_set_dimensions(tb->url.textarea,
- aes_toolbar[TOOLBAR_AREA_URL].ob_width,
- aes_toolbar[TOOLBAR_AREA_URL].ob_height);
+ tb->form[TOOLBAR_AREA_URL].ob_width,
+ tb->form[TOOLBAR_AREA_URL].ob_height);
tb->reflow = true;
}
}
@@ -538,8 +551,8 @@ void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area)
toolbar_reflow(tb);
/* this will request an textarea redraw: */
textarea_set_dimensions(tb->url.textarea,
- aes_toolbar[TOOLBAR_AREA_URL].ob_width,
- aes_toolbar[TOOLBAR_AREA_URL].ob_height);
+ tb->form[TOOLBAR_AREA_URL].ob_width,
+ tb->form[TOOLBAR_AREA_URL].ob_height);
}
else {
tb->area = *area;
@@ -728,10 +741,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
/* select whole text when newly focused, otherwise set caret to
end of text */
if (!window_url_widget_has_focus(tb->owner)) {
- window_set_focus(tb->owner, URL_WIDGET, (void*)&tb->url );
- }
- if (button & 2) {
- // TODO: open a context popup
+ window_set_focus(tb->owner, URL_WIDGET, (void*)&tb->url);
}
/* url widget has focus and mouse button is still pressed... */
else if (mb & 1) {
@@ -756,14 +766,17 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
textarea_drag_end( tb->url.textarea, 0, mx, my);
}
+ else if (button & 2) {
+ // TODO: open a context popup
+ }
else {
/* when execution reaches here, mouse input is a click or dclick */
/* TODO: recognize click + shitoolbar_update_buttonsft key */
int mstate = BROWSER_MOUSE_PRESS_1;
- if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 ){
+ if ((kstat & (K_LSHIFT|K_RSHIFT)) != 0) {
mstate = BROWSER_MOUSE_MOD_1;
}
- if( aes_event_out.emo_mclicks == 2 ){
+ if (aes_event_out.emo_mclicks == 2 ) {
textarea_mouse_action( tb->url.textarea,
BROWSER_MOUSE_DOUBLE_CLICK | BROWSER_MOUSE_CLICK_1, mx,
my);
@@ -775,13 +788,21 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
}
}
}
+ else if(obj==TOOLBAR_TB_SRCH) {
+ window_set_focus(tb->owner, SEARCH_INPUT, NULL);
+ }
else if (obj==TOOLBAR_BT_SEARCH_FWD) {
gw = tb->owner->active_gui_window;
- toolbar_tree = gemtk_obj_get_tree(TOOLBAR);
assert(gw->search);
- nsatari_search_perform(gw->search, toolbar_tree, SEARCH_FLAG_FORWARDS);
+ nsatari_search_perform(gw->search, tb->form, SEARCH_FLAG_FORWARDS);
+ }
+ else if (obj==TOOLBAR_BT_SEARCH_BACK) {
+ gw = tb->owner->active_gui_window;
+ assert(gw->search);
+ nsatari_search_perform(gw->search, tb->form, 0);
}
else if (obj==TOOLBAR_BT_CLOSE_SEARCH) {
+ tb->form[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED;
window_close_search(tb->owner);
}
else {
@@ -813,11 +834,11 @@ void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT
*dst)
toolbar_reflow(tb);
}
- objc_offset(aes_toolbar, which, &dst->g_x, &dst->g_y);
+ objc_offset(tb->form, which, &dst->g_x, &dst->g_y);
- dst->g_w = aes_toolbar[which].ob_width;
- dst->g_h = aes_toolbar[which].ob_height;
- //aes_toolbar[which].ob_height;
+ dst->g_w = tb->form[which].ob_width;
+ dst->g_h = tb->form[which].ob_height;
+ //tb->form[which].ob_height;
//printf("Toolbar get grect (%d): ", which);
//dbg_grect("", dst);
@@ -832,6 +853,11 @@ struct textarea *toolbar_get_textarea(struct s_toolbar *tb,
return(tb->url.textarea);
}
+OBJECT *toolbar_get_form(struct s_toolbar *tb)
+{
+ return(tb->form);
+}
+
/* public event handler */
void toolbar_back_click(struct s_toolbar *tb)
diff --git a/atari/toolbar.h b/atari/toolbar.h
index 24ea9e2..3116aa9 100644
--- a/atari/toolbar.h
+++ b/atari/toolbar.h
@@ -31,13 +31,13 @@ struct s_toolbar
struct s_gui_win_root *owner;
struct s_url_widget url;
struct s_throbber_widget throbber;
+ OBJECT *form;
GRECT area;
/* size & location of buttons: */
struct s_tb_button * buttons;
int btcnt;
int style;
bool attached;
- bool redraw;
bool reflow;
bool visible;
bool search_visible;
@@ -54,6 +54,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short mbut);
void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw,
short idx);
void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT *g);
+OBJECT *toolbar_get_form(struct s_toolbar *tb);
struct textarea *toolbar_get_textarea(struct s_toolbar *tb,
enum toolbar_textarea which);
void toolbar_set_throbber_state(struct s_toolbar *tb, bool active);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/985e4ce6be424aec5e7...
commit 985e4ce6be424aec5e797d92c09e0ee22cde7874
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Prefixed gemtk module functions.
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index a82824e..d89060a 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -128,7 +128,7 @@ void context_popup(struct gui_window * gw, short x, short y)
char cmdline[PATH_MAX];
MENU pop_menu, me_data;
- pop = get_tree( POP_CTX );
+ pop = gemtk_obj_get_tree( POP_CTX );
if (pop == NULL)
return;
ctx = get_context_info(gw, x, y);
@@ -163,7 +163,7 @@ void context_popup(struct gui_window * gw, short x, short y)
}
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_CTX);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_CTX);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_CTX_CUT_SEL;
pop_menu.mn_scroll = SCROLL_NO;
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index d4621a3..0811b12 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -314,7 +314,7 @@ static void __CDECL menu_savewin(short item, short title, void *data)
LOG(("%s", __FUNCTION__));
if (input_window && input_window->browser) {
GRECT rect;
- wind_get_grect(guiwin_get_handle(input_window->root->win), WF_CURRXYWH,
+ wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH,
&rect);
option_window_width = rect.g_w;
option_window_height = rect.g_h;
@@ -522,7 +522,7 @@ void deskmenu_init(void)
{
int i;
- h_gem_menu = get_tree(MAINMENU);
+ h_gem_menu = gemtk_obj_get_tree(MAINMENU);
/* Install menu: */
@@ -616,7 +616,7 @@ int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short
kstate,
bool done = 0;
int i = 0;
- sascii = keybd2ascii(kcode, K_LSHIFT);
+ sascii = gemtk_keybd2ascii(kcode, K_LSHIFT);
/* Iterate through the menu function table: */
while( menu_evnt_tbl[i].rid != -1 && done == false) {
diff --git a/atari/download.c b/atari/download.c
index d20fd88..936b8a5 100755
--- a/atari/download.c
+++ b/atari/download.c
@@ -61,7 +61,7 @@ static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip)
struct gui_download_window *data;
if (msg != WM_REDRAW) {
- data = guiwin_get_user_data(win);
+ data = gemtk_wm_get_user_data(win);
assert(data);
@@ -76,7 +76,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
GRECT clip;
- data = guiwin_get_user_data(win);
+ data = gemtk_wm_get_user_data(win);
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -133,7 +133,7 @@ static void on_redraw(struct gui_download_window *dw, GRECT *clip)
GRECT work, visible;
uint32_t p = 0;
- guiwin_get_grect(dw->guiwin, GUIWIN_AREA_TOOLBAR, &work);
+ gemtk_wm_get_grect(dw->guiwin, GEMTK_WM_AREA_TOOLBAR, &work);
tree->ob_x = work.g_x;
tree->ob_y = work.g_y;
@@ -175,7 +175,7 @@ static void on_abort_click(struct gui_download_window *dw)
{
if( dw->status == NSATARI_DOWNLOAD_COMPLETE
|| dw->status == NSATARI_DOWNLOAD_ERROR ) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
}
else if( dw->status != NSATARI_DOWNLOAD_CANCELED ){
dw->abort = true;
@@ -186,9 +186,9 @@ static void on_cbrdy_click(struct gui_download_window *dw)
{
dw->close_on_finish = !dw->close_on_finish;
if (dw->close_on_finish && dw->status == NSATARI_DOWNLOAD_COMPLETE) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
}
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
evnt_timer(250);
}
@@ -218,7 +218,7 @@ static void gui_download_window_destroy( struct gui_download_window *
gdw)
if (gdw->fbuf != NULL) {
free( gdw->fbuf );
}
- guiwin_remove(gdw->guiwin);
+ gemtk_wm_remove(gdw->guiwin);
wind_close(gdw->aes_handle);
wind_delete(gdw->aes_handle);
free(gdw);
@@ -256,7 +256,7 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
const char * url;
struct gui_download_window * gdw;
int dlgres = 0;
- OBJECT * tree = get_tree(DOWNLOAD);
+ OBJECT * tree = gemtk_obj_get_tree(DOWNLOAD);
char alert[200];
@@ -314,7 +314,7 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
if( gdw->fd == NULL ){
char spare[200];
snprintf(spare, 200, "Couldn't open %s for writing!",
gdw->destination);
- msg_box_show(MSG_BOX_ALERT, spare);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, spare);
gui_download_window_destroy(gdw);
return( NULL );
}
@@ -326,16 +326,16 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
gdw->aes_handle = wind_create_grect(CLOSER | NAME | MOVER, &desk_area);
wind_set_str(gdw->aes_handle, WF_NAME, "Download");
- unsigned long gwflags = GW_FLAG_DEFAULTS;
- gdw->guiwin = guiwin_add(gdw->aes_handle, gwflags, on_aes_event);
+ unsigned long gwflags = GEMTK_WM_FLAG_DEFAULTS;
+ gdw->guiwin = gemtk_wm_add(gdw->aes_handle, gwflags, on_aes_event);
if( gdw->guiwin == NULL || gdw->fd == NULL ){
die("could not create guiwin");
gui_download_window_destroy(gdw);
return( NULL );
}
- guiwin_set_user_data(gdw->guiwin, gdw);
- guiwin_set_toolbar(gdw->guiwin, tree, 0, 0);
- guiwin_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
+ gemtk_wm_set_user_data(gdw->guiwin, gdw);
+ gemtk_wm_set_toolbar(gdw->guiwin, tree, 0, 0);
+ gemtk_wm_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
strncpy((char*)&gdw->lbl_file, filename, MAX_SLEN_LBL_FILE-1);
LOG(("created download: %s (total size: %d)",
@@ -379,7 +379,7 @@ nserror gui_download_window_data(struct gui_download_window *dw,
dw->status = NSATARI_DOWNLOAD_CANCELED;
dw->abort = false;
download_context_abort(dw->ctx);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
return(NSERROR_OK);
}
@@ -411,7 +411,7 @@ nserror gui_download_window_data(struct gui_download_window *dw,
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : "?"
);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
}
return NSERROR_OK;
}
@@ -422,7 +422,7 @@ void gui_download_window_error(struct gui_download_window *dw,
LOG(("%s", error_msg));
strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1);
dw->status = NSATARI_DOWNLOAD_ERROR;
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
gui_window_set_status(input_window, messages_get("Done") );
// TODO: change abort to close
}
@@ -442,7 +442,7 @@ void gui_download_window_done(struct gui_download_window *dw)
tree = dw->tree;
if (dw->close_on_finish) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0, 0, 0, 0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0, 0, 0, 0);
} else {
snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
"%lu%s", 100, "%"
@@ -451,7 +451,7 @@ void gui_download_window_done(struct gui_download_window *dw)
human_friendly_bytesize(dw->size_downloaded),
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) :
human_friendly_bytesize(dw->size_downloaded)
);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
}
gui_window_set_status(input_window, messages_get("Done") );
}
diff --git a/atari/gemtk/dragdrop.c b/atari/gemtk/dragdrop.c
index e4ae2da..a4b7b82 100755
--- a/atari/gemtk/dragdrop.c
+++ b/atari/gemtk/dragdrop.c
@@ -50,7 +50,7 @@ static long pipesig;
* -1: Fehler beim Erzeugen der Pipe
*/
-short ddcreate(short *pipe)
+short gemtk_dd_create(short *pipe)
{
long fd = -1;
@@ -83,7 +83,7 @@ short ddcreate(short *pipe)
/* Signalhandler konfigurieren */
- ddgetsig(&pipesig);
+ gemtk_dd_getsig(&pipesig);
return((short) fd);
@@ -113,7 +113,7 @@ short ddcreate(short *pipe)
* -3: Fehler bei appl_write()
*/
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate,
short pipeid)
+short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short
kstate, short pipeid)
{
char c;
short i, msg[8];
@@ -135,7 +135,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my,
short kst
if (i == 0)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-3);
}
@@ -148,7 +148,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my,
short kst
{
/* Timeout eingetreten */
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-2);
}
@@ -157,13 +157,13 @@ short ddmessage(short apid, short fd, short winid, short mx, short
my, short kst
if (Fread(fd, 1L, &c) != 1L)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
if (c != DD_OK)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -187,11 +187,11 @@ short ddmessage(short apid, short fd, short winid, short mx, short
my, short kst
* -1: Fehler beim Lesen aus der Pipe
*/
-short ddrexts(short fd, char *exts)
+short gemtk_dd_rexts(short fd, char *exts)
{
if (Fread(fd, DD_EXTSIZE, exts) != DD_EXTSIZE)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -204,7 +204,7 @@ short ddrexts(short fd, char *exts)
* Testet, ob der Empf�nger einen Datentyp akzeptiert
*
* Eingabeparameter:
-* fd - Filehandle (von ddcreate())
+* fd - Filehandle (von gemtk_dd_create())
* ext - Zeiger auf Datentyp (4 Bytes zB. "ARGS")
* text - Zeiger auf Datenbeschreibung (optional, zB. "DESKTOP args")
* name - Zeiger auf Datendateiname (optional, zB. "SAMPLE.TXT")
@@ -223,7 +223,7 @@ short ddrexts(short fd, char *exts)
* DD_CLIPBOARD - Drop erfolgte auf Clipboard
*/
-short ddstry(short fd, char *ext, char *text, char *name, long size)
+short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size)
{
char c;
short hdrlen, i;
@@ -264,11 +264,11 @@ short ddstry(short fd, char *ext, char *text, char *name, long
size)
* Pipe schlie�en (Drag&Drop beenden/abbrechen)
*/
-void ddclose(short fd)
+void gemtk_dd_close(short fd)
{
/* Signalhandler restaurieren */
- ddsetsig(pipesig);
+ gemtk_dd_setsig(pipesig);
Fclose(fd);
@@ -288,7 +288,7 @@ void ddclose(short fd)
* keine
*/
-void ddgetsig(long *oldsig)
+void gemtk_dd_getsig(long *oldsig)
{
*oldsig = (long) Psignal(SIGPIPE, (void *) SIG_IGN);
}
@@ -298,7 +298,7 @@ void ddgetsig(long *oldsig)
* Signalhandler nach D&D restaurieren
*
* Eingabeparameter:
-* oldsig - Alter Handlerwert (von ddgetsig)
+* oldsig - Alter Handlerwert (von gemtk_dd_getsig)
*
* Ausgabeparameter:
* keine
@@ -307,7 +307,7 @@ void ddgetsig(long *oldsig)
* keine
*/
-void ddsetsig(long oldsig)
+void gemtk_dd_setsig(long oldsig)
{
if (oldsig != -32L)
Psignal(SIGPIPE, (void *) oldsig);
@@ -332,7 +332,7 @@ void ddsetsig(long oldsig)
* -1 - Drag&Drop abgebrochen
*/
-short ddopen(short ddnam, char ddmsg)
+short gemtk_dd_open(short ddnam, char ddmsg)
{
long fd;
@@ -347,12 +347,12 @@ short ddopen(short ddnam, char ddmsg)
/* Signalhandler konfigurieren */
- ddgetsig(&pipesig);
+ gemtk_dd_getsig(&pipesig);
if (Fwrite((short) fd, 1L, &ddmsg) != 1L)
{
- ddclose((short) fd);
+ gemtk_dd_close((short) fd);
return(-1);
}
@@ -380,11 +380,11 @@ short ddopen(short ddnam, char ddmsg)
* -1: Fehler beim Schreiben in die Pipe
*/
-short ddsexts(short fd, char *exts)
+short gemtk_dd_sexts(short fd, char *exts)
{
if (Fwrite(fd, DD_EXTSIZE, exts) != DD_EXTSIZE)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -397,7 +397,7 @@ short ddsexts(short fd, char *exts)
* N�chsten Header vom Sender holen
*
* Eingabeparameter:
-* fd - Filehandle der Pipe (von ddopen())
+* fd - Filehandle der Pipe (von gemtk_dd_open())
*
* Ausgabeparameters:
* name - Zeiger auf Buffer f�r Datenbeschreibung (min. DD_NAMEMAX!)
@@ -419,7 +419,7 @@ short ddsexts(short fd, char *exts)
* les string sont limit� a 128 octets
*/
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size)
+short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size)
{
char buf[DD_NAMEMAX * 2];
short hdrlen, i, len;
@@ -490,7 +490,7 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long
*size)
* Sendet der Senderapplikation eine 1 Byte Antwort
*
* Eingabeparameter:
-* fd - Filehandle der Pipe (von ddopen())
+* fd - Filehandle der Pipe (von gemtk_dd_open())
* ack - Byte das gesendet werden soll (zB. DD_OK)
*
* Ausgabeparameter:
@@ -501,11 +501,11 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long
*size)
* -1: Fehler (die Pipe wird automatisch geschlossen!)
*/
-short ddreply(short fd, char ack)
+short gemtk_dd_reply(short fd, char ack)
{
if (Fwrite(fd, 1L, &ack) != 1L)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 679858a..1fb1426 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -37,12 +37,12 @@ unsigned short _systype (void);
* Chech for GRECT intersection without modifiend the src rectangles
* return true when the GRECT's intersect, fals otherwise.
*/
-bool rc_intersect_ro(GRECT *a, GRECT *b);
+bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b);
/*
* Convert keycode returned by evnt_multi to ascii value
*/
-int keybd2ascii( int keybd, int shift);
+int gemtk_keybd2ascii( int keybd, int shift);
/** set VDI clip area by passing an GRECT */
void gemtk_clip_grect(VdiHdl vh, GRECT *rect);
@@ -75,45 +75,44 @@ void gemtk_clip_grect(VdiHdl vh, GRECT *rect);
/* -------------------------------------------------------------------------- */
/* MultiTOS Drag & Drop */
/* -------------------------------------------------------------------------- */
-short ddcreate(short *pipe);
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate,
short pipename);
-short ddrexts(short fd, char *exts);
-short ddstry(short fd, char *ext, char *text, char *name, long size);
-void ddclose(short fd);
-void ddgetsig(long *oldsig);
-void ddsetsig(long oldsig);
-short ddopen(short ddnam, char ddmsg);
-short ddsexts(short fd, char *exts);
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
-short ddreply(short fd, char ack);
+short gemtk_dd_create(short *pipe);
+short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short
kstate, short pipename);
+short gemtk_dd_rexts(short fd, char *exts);
+short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size);
+void gemtk_dd_close(short fd);
+void gemtk_dd_getsig(long *oldsig);
+void gemtk_dd_setsig(long oldsig);
+short gemtk_dd_open(short ddnam, char ddmsg);
+short gemtk_dd_sexts(short fd, char *exts);
+short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size);
+short gemtk_dd_reply(short fd, char ack);
/* -------------------------------------------------------------------------- */
/* Message Box module */
/* -------------------------------------------------------------------------- */
-#define MSG_BOX_ALERT 1
-#define MSG_BOX_CONFIRM 2
+#define GEMTK_MSG_BOX_ALERT 1
+#define GEMTK_MSG_BOX_CONFIRM 2
-short msg_box_show(short type, const char * msg);
+short gemtk_msg_box_show(short type, const char * msg);
/* -------------------------------------------------------------------------- */
/* GUIWIN Module */
/* -------------------------------------------------------------------------- */
-#define GW_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events
-#define GW_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed
-#define GW_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical
-#define GW_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
-#define GW_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling
+#define GEMTK_WM_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events
+#define GEMTK_WM_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed
+#define GEMTK_WM_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical
+#define GEMTK_WM_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
+#define GEMTK_WM_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling
-#define GW_FLAG_DEFAULTS (GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM)
+#define GEMTK_WM_FLAG_DEFAULTS \
+ (GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM)
-#define GW_STATUS_ICONIFIED 0x01
-#define GW_STATUS_SHADED 0x02
+#define GEMTK_WM_STATUS_ICONIFIED 0x01
+#define GEMTK_WM_STATUS_SHADED 0x02
-#define GW_CB_SELECTED (OS_SELECTED)
-
-#define GUIWIN_VSLIDER 0x01
-#define GUIWIN_HSLIDER 0x02
-#define GUIWIN_VH_SLIDER 0x03
+#define GEMTK_WM_VSLIDER 0x01
+#define GEMTK_WM_HSLIDER 0x02
+#define GEMTK_WM_VH_SLIDER 0x03
/*
Message sent to the client application when an AES object is
@@ -124,20 +123,20 @@ short msg_box_show(short type, const char * msg);
msg[5] = Number of clicks.
msg[6] = Modifier keys.
*/
-#define GUIWIN_WM_FORM 1001
+#define GEMTK_WM_WM_FORM 1001
-struct gui_window_s;
+struct gemtk_window_s;
/** list struct for managing AES windows */
-typedef struct gui_window_s GUIWIN;
+typedef struct gemtk_window_s GUIWIN;
/** GUIWIN event handler */
-typedef short (*guiwin_event_handler_f)(GUIWIN *gw,
+typedef short (*gemtk_wm_event_handler_f)(GUIWIN *gw,
EVMULT_OUT *ev_out, short msg[8]);
-typedef void (*guiwin_redraw_f)(GUIWIN *win, uint16_t msg, GRECT *clip);
+typedef void (*gemtk_wm_redraw_f)(GUIWIN *win, uint16_t msg, GRECT *clip);
-struct guiwin_scroll_info_s {
+struct gemtk_wm_scroll_info_s {
/** Definition of a content unit (horizontal) measured in pixel */
int x_unit_px;
@@ -160,9 +159,9 @@ struct guiwin_scroll_info_s {
/** Well known areas inside the window */
enum guwin_area_e {
- GUIWIN_AREA_WORK = 0,
- GUIWIN_AREA_TOOLBAR,
- GUIWIN_AREA_CONTENT
+ GEMTK_WM_AREA_WORK = 0,
+ GEMTK_WM_AREA_TOOLBAR,
+ GEMTK_WM_AREA_CONTENT
};
/* -------------------------------------------------------------------------- */
@@ -170,67 +169,67 @@ enum guwin_area_e {
/* -------------------------------------------------------------------------- */
short
-guiwin_init(void);
+gemtk_wm_init(void);
void
-guiwin_exit(void);
+gemtk_wm_exit(void);
-GUIWIN * guiwin_add(short handle, uint32_t flags,
- guiwin_event_handler_f handler);
+GUIWIN * gemtk_wm_add(short handle, uint32_t flags,
+ gemtk_wm_event_handler_f handler);
-GUIWIN * guiwin_find(short handle);
+GUIWIN * gemtk_wm_find(short handle);
-short guiwin_remove(GUIWIN *win);
+short gemtk_wm_remove(GUIWIN *win);
-GUIWIN * guiwin_validate_ptr(GUIWIN *win);
+GUIWIN * gemtk_wm_validate_ptr(GUIWIN *win);
-short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]);
+short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]);
-void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest);
+void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest);
-short guiwin_get_handle(GUIWIN *win);
+short gemtk_wm_get_handle(GUIWIN *win);
-uint32_t guiwin_get_state(GUIWIN *win);
+uint32_t gemtk_wm_get_state(GUIWIN *win);
-void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
+void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
uint32_t flags);
-void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f cb);
+void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb);
-void guiwin_set_user_data(GUIWIN *win, void *data);
+void gemtk_wm_set_user_data(GUIWIN *win, void *data);
-void * guiwin_get_user_data(GUIWIN *win);
+void * gemtk_wm_get_user_data(GUIWIN *win);
-struct guiwin_scroll_info_s * guiwin_get_scroll_info(GUIWIN *win);
+struct gemtk_wm_scroll_info_s * gemtk_wm_get_scroll_info(GUIWIN *win);
-void guiwin_set_scroll_grid(GUIWIN * win, short x, short y);
+void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y);
-void guiwin_set_content_units(GUIWIN * win, short x, short y);
+void gemtk_wm_set_content_units(GUIWIN * win, short x, short y);
-void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index);
+void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index);
-void guiwin_set_toolbar_size(GUIWIN *win, uint16_t s);
+void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s);
-void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f func);
+void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func);
-bool guiwin_update_slider(GUIWIN *win, short mode);
+bool gemtk_wm_update_slider(GUIWIN *win, short mode);
-void guiwin_scroll(GUIWIN *gw, short orientation, int units, bool refresh);
+void gemtk_wm_scroll(GUIWIN *gw, short orientation, int units, bool refresh);
-void guiwin_send_msg(GUIWIN *win, short msgtype, short a, short b, short c,
+void gemtk_wm_send_msg(GUIWIN *win, short msgtype, short a, short b, short c,
short d);
-void guiwin_send_redraw(GUIWIN *win, GRECT *area);
+void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area);
-VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
+VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win);
-bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
+bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work);
-void guiwin_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip);
+void gemtk_wm_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip);
-void guiwin_form_redraw(GUIWIN *gw, GRECT *clip);
+void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip);
-void guiwin_clear(GUIWIN *win);
+void gemtk_wm_clear(GUIWIN *win);
/* -------------------------------------------------------------------------- */
/* AES SCROLLER MODULE */
@@ -244,9 +243,9 @@ void guiwin_clear(GUIWIN *win);
/* AES OBJECT TREE TOOLS */
/* -------------------------------------------------------------------------- */
char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt);
-char *get_text(OBJECT * tree, short idx);
-GRECT * obj_screen_rect(OBJECT * tree, short obj);
-bool obj_is_inside(OBJECT * tree, short obj, GRECT *area);
-OBJECT *get_tree(int idx);
+char *gemtk_obj_get_text(OBJECT * tree, short idx);
+GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj);
+bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area);
+OBJECT *gemtk_obj_get_tree(int idx);
void gemtk_obj_mouse_sprite(OBJECT *tree, int index);
#endif // GEMTK_H_INCLUDED
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 097eb6e..9dc3868 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -29,16 +29,16 @@
//#define DEBUG_PRINT(x) printf x
#define DEBUG_PRINT(x)
-struct gui_window_s {
+struct gemtk_window_s {
/** The AES handle of the window */
short handle;
/** the generic event handler function for events passed to the client */
- guiwin_event_handler_f handler_func;
+ gemtk_wm_event_handler_f handler_func;
/** The custom toolbar redraw function, if any */
- guiwin_redraw_f toolbar_redraw_func;
+ gemtk_wm_redraw_f toolbar_redraw_func;
/** window configuration */
uint32_t flags;
@@ -58,8 +58,8 @@ struct gui_window_s {
/** Describes the start of the toolbar tree (usually 0) */
short toolbar_idx;
- /** depending on the flag GW_FLAG_HAS_VTOOLBAR this defines the toolbar
- height or the toolbar width (GW_FLAG_HAS_VTOOLBAR means width).
+ /** depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this defines the toolbar
+ height or the toolbar width (GEMTK_WM_FLAG_HAS_VTOOLBAR means width).
*/
short toolbar_size;
@@ -76,13 +76,13 @@ struct gui_window_s {
short form_idx;
/** Scroll state */
- struct guiwin_scroll_info_s scroll_info;
+ struct gemtk_wm_scroll_info_s scroll_info;
/** Arbitary data set by the user */
void *user_data;
/** linked list items */
- struct gui_window_s *next, *prev;
+ struct gemtk_window_s *next, *prev;
};
static GUIWIN * winlist;
@@ -95,7 +95,7 @@ static void move_rect(GUIWIN * win, GRECT *rect, int dx, int dy)
long dum = 0L;
GRECT g;
- VdiHdl vh = guiwin_get_vdi_handle(win);
+ VdiHdl vh = gemtk_wm_get_vdi_handle(win);
while(!wind_update(BEG_UPDATE));
graf_mouse(M_OFF, 0L);
@@ -126,14 +126,14 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
GRECT g, g_ro, g2;
short retval = 1;
int val = 1, old_val;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
switch(msg[0]) {
case WM_HSLID:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
if(val != slid->x_pos) {
if (val < slid->x_pos) {
@@ -141,14 +141,14 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
} else {
val = val-slid->x_pos;
}
- guiwin_scroll(gw, GUIWIN_HSLIDER, val, false);
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, val, false);
}
break;
case WM_VSLID:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
wind_set(gw->handle, WF_VSLIDE, msg[4], 0, 0, 0);
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
val = (float)(slid->y_units-(g.g_h/slid->y_unit_px))/1000*(float)msg[4];
if(val != slid->y_pos) {
if (val < slid->y_pos) {
@@ -156,62 +156,62 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
} else {
val = val -slid->y_pos;
}
- guiwin_scroll(gw, GUIWIN_VSLIDER, val, false);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, val, false);
}
break;
case WM_ARROWED:
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
- slid = guiwin_get_scroll_info(gw);
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ slid = gemtk_wm_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
g_ro = g;
switch(msg[4]) {
case WA_UPPAGE:
/* scroll page up */
- guiwin_scroll(gw, GUIWIN_VSLIDER, -(g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -(g.g_h/slid->y_unit_px),
true);
break;
case WA_UPLINE:
/* scroll line up */
- guiwin_scroll(gw, GUIWIN_VSLIDER, -1, true);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -1, true);
break;
case WA_DNPAGE:
/* scroll page down */
- guiwin_scroll(gw, GUIWIN_VSLIDER, g.g_h/slid->y_unit_px,
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, g.g_h/slid->y_unit_px,
true);
break;
case WA_DNLINE:
/* scroll line down */
- guiwin_scroll(gw, GUIWIN_VSLIDER, +1, true);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, +1, true);
break;
case WA_LFPAGE:
/* scroll page left */
- guiwin_scroll(gw, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px),
true);
break;
case WA_LFLINE:
/* scroll line left */
- guiwin_scroll(gw, GUIWIN_HSLIDER, -1,
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -1,
true);
break;
case WA_RTPAGE:
/* scroll page right */
- guiwin_scroll(gw, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px),
true);
break;
case WA_RTLINE:
/* scroll line right */
- guiwin_scroll(gw, GUIWIN_HSLIDER, 1,
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, 1,
true);
break;
@@ -231,8 +231,8 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
if (gw->form) {
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
- slid = guiwin_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
+ slid = gemtk_wm_get_scroll_info(gw);
gw->form[gw->form_idx].ob_x = g.g_x -
(slid->x_pos * slid->x_unit_px);
@@ -251,9 +251,9 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
g.g_h = MIN(msg[7], g2.g_h);
if(g2.g_w != g.g_w || g2.g_h != g.g_h) {
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, g.g_w, g.g_h);
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
- guiwin_send_redraw(gw, NULL);
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) {
+ gemtk_wm_send_redraw(gw, NULL);
}
}
}
@@ -268,45 +268,45 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
wind_get_grect(gw->handle, WF_PREVXYWH, &g);
}
wind_set_grect(gw->handle, WF_CURRXYWH, &g);
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
- guiwin_send_redraw(gw, NULL);
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) {
+ gemtk_wm_send_redraw(gw, NULL);
}
}
break;
case WM_ICONIFY:
wind_set(gw->handle, WF_ICONIFY, msg[4], msg[5], msg[6], msg[7]);
- gw->state |= GW_STATUS_ICONIFIED;
+ gw->state |= GEMTK_WM_STATUS_ICONIFIED;
break;
case WM_UNICONIFY:
wind_set(gw->handle, WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7]);
- gw->state &= ~(GW_STATUS_ICONIFIED);
+ gw->state &= ~(GEMTK_WM_STATUS_ICONIFIED);
break;
case WM_SHADED:
- gw->state |= GW_STATUS_SHADED;
+ gw->state |= GEMTK_WM_STATUS_SHADED;
break;
case WM_UNSHADED:
- gw->state &= ~(GW_STATUS_SHADED);
+ gw->state &= ~(GEMTK_WM_STATUS_SHADED);
break;
case WM_REDRAW:
- if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) {
+ if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0) {
g.g_x = msg[4];
g.g_y = msg[5];
g.g_w = msg[6];
g.g_h = msg[7];
- guiwin_toolbar_redraw(gw, WM_REDRAW, &g);
+ gemtk_wm_toolbar_redraw(gw, WM_REDRAW, &g);
}
if (gw->form != NULL) {
g.g_x = msg[4];
g.g_y = msg[5];
g.g_w = msg[6];
g.g_h = msg[7];
- guiwin_form_redraw(gw, &g);
+ gemtk_wm_form_redraw(gw, &g);
}
break;
@@ -329,12 +329,12 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out,
short msg[8])
DEBUG_PRINT(("preproc_mu_button\n"));
// toolbar handling:
- if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0
+ if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0
&& gw->toolbar != NULL) {
GRECT tb_area;
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y, tb_area)) {
@@ -351,7 +351,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
DEBUG_PRINT(("Toolbar index: %d\n", obj_idx));
if (obj_idx > -1
&& (gw->toolbar[obj_idx].ob_state & OS_DISABLED)== 0
- && ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0)) {
+ && ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0)) {
uint16_t type = (gw->toolbar[obj_idx].ob_type & 0xFF);
uint16_t nextobj;
@@ -392,16 +392,16 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out,
short msg[8])
if (gw->form != NULL) {
GRECT content_area;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
DEBUG_PRINT(("preproc_mu_button: handling form click.\n"));
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &content_area);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &content_area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y, content_area)) {
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
// adjust form position (considering window and scroll position):
gw->form[gw->form_idx].ob_x = content_area.g_x -
@@ -434,7 +434,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
}
short oldevents = ev_out->emo_events;
- short msg_out[8] = { GUIWIN_WM_FORM, gl_apid,
+ short msg_out[8] = { GEMTK_WM_WM_FORM, gl_apid,
0, gw->handle,
gw->form_focus_obj, ev_out->emo_mclicks,
ev_out->emo_kmeta, 0
@@ -534,14 +534,14 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
* Event Dispatcher function. The guiwin API doesn't own an event loop,
* so you have to inform it for every event that you want it to handle.
*/
-short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
+short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
{
GUIWIN *dest;
short retval = 0;
bool handler_called = false;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
- DEBUG_PRINT(("guiwin_handle_event_multi_fast: %d (%x)\n", msg[0],
+ DEBUG_PRINT(("gemtk_wm_handle_event_multi_fast: %d (%x)\n", msg[0],
msg[0]));
switch (msg[0]) {
case WM_REDRAW:
@@ -565,12 +565,12 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
case AP_DRAGDROP:
case AP_TERM:
case AP_TFAIL:
- dest = guiwin_find(msg[3]);
+ dest = gemtk_wm_find(msg[3]);
if (dest) {
DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n",
dest, dest->handle, dest->flags, dest->handler_func));
- if (dest->flags&GW_FLAG_PREPROC_WM) {
+ if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) {
retval = preproc_wm(dest, ev_out, msg);
- if(((retval == 0)||(dest->flags&GW_FLAG_RECV_PREPROC_WM))) {
+ if(((retval ==
0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) {
retval = dest->handler_func(dest, ev_out, msg);
handler_called = true;
}
@@ -590,7 +590,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
h_aes = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
if(h_aes > 0 && (ev_out->emo_events != MU_TIMER)) {
- dest = guiwin_find(h_aes);
+ dest = gemtk_wm_find(h_aes);
if (dest == NULL || dest->handler_func == NULL)
return(0);
@@ -623,7 +623,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
/**
* Initialises the guiwin API
*/
-short guiwin_init(void)
+short gemtk_wm_init(void)
{
if(v_vdi_h == -1) {
short dummy;
@@ -634,7 +634,7 @@ short guiwin_init(void)
return(0);
}
-void guiwin_exit(void)
+void gemtk_wm_exit(void)
{
v_clsvwk(v_vdi_h);
}
@@ -647,13 +647,13 @@ void guiwin_exit(void)
* \param flags Creation flags, configures how the AES window is handled
* \param cb event handler function for that window
*/
-GUIWIN * guiwin_add(short handle, uint32_t flags, guiwin_event_handler_f cb)
+GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb)
{
GUIWIN *win = calloc(sizeof(GUIWIN),1);
assert(win!=NULL);
- DEBUG_PRINT(("guiwin_add: %d, %p, cb: %p\n", handle, win, cb));
+ DEBUG_PRINT(("gemtk_wm_add: %d, %p, cb: %p\n", handle, win, cb));
win->handle = handle;
win->handler_func = cb;
@@ -679,7 +679,7 @@ GUIWIN * guiwin_add(short handle, uint32_t flags,
guiwin_event_handler_f cb)
/**
* Returns an GUIWIN* for AES handle, when that AES window is managed by guiwin
*/
-GUIWIN *guiwin_find(short handle)
+GUIWIN *gemtk_wm_find(short handle)
{
GUIWIN *g;
DEBUG_PRINT(("guiwin search handle: %d\n", handle));
@@ -696,13 +696,13 @@ GUIWIN *guiwin_find(short handle)
/**
* Check's if the pointer is managed by the guiwin API.
*/
-GUIWIN *guiwin_validate_ptr(GUIWIN *win)
+GUIWIN *gemtk_wm_validate_ptr(GUIWIN *win)
{
GUIWIN *g;
for( g = winlist; g != NULL; g=g->next ) {
- DEBUG_PRINT(("guiwin guiwin_validate_ptr check: %p\n", g));
+ DEBUG_PRINT(("guiwin gemtk_wm_validate_ptr check: %p\n", g));
if(g == win) {
- DEBUG_PRINT(("guiwin_validate_ptr valid: %p\n", g));
+ DEBUG_PRINT(("gemtk_wm_validate_ptr valid: %p\n", g));
return(g);
}
}
@@ -713,9 +713,9 @@ GUIWIN *guiwin_validate_ptr(GUIWIN *win)
* Remove an GUIWIN from the list of managed windows.
* Call this when the AES window is closed or deleted.
*/
-short guiwin_remove(GUIWIN *win)
+short gemtk_wm_remove(GUIWIN *win)
{
- win = guiwin_validate_ptr(win);
+ win = gemtk_wm_validate_ptr(win);
if (win == NULL)
return(-1);
@@ -738,17 +738,17 @@ short guiwin_remove(GUIWIN *win)
* \param mode Specifies the area to retrieve.
* \param dest The calculated rectangle.
*/
-void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest)
+void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest)
{
assert(win != NULL);
wind_get_grect(win->handle, WF_WORKXYWH, dest);
- if (mode == GUIWIN_AREA_CONTENT) {
+ if (mode == GEMTK_WM_AREA_CONTENT) {
GRECT tb_area;
- guiwin_get_grect(win, GUIWIN_AREA_TOOLBAR, &tb_area);
- if (win->flags & GW_FLAG_HAS_VTOOLBAR) {
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &tb_area);
+ if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
dest->g_x += tb_area.g_w;
dest->g_w -= tb_area.g_w;
}
@@ -756,9 +756,9 @@ void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT
*dest)
dest->g_y += tb_area.g_h;
dest->g_h -= tb_area.g_h;
}
- } else if (mode == GUIWIN_AREA_TOOLBAR) {
+ } else if (mode == GEMTK_WM_AREA_TOOLBAR) {
if (win->toolbar) {
- if (win->flags & GW_FLAG_HAS_VTOOLBAR) {
+ if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
dest->g_w = win->toolbar_size;
} else {
dest->g_h = win->toolbar_size;
@@ -773,24 +773,24 @@ void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT
*dest)
/**
-* Scroll the content area (GUIWIN_AREA_CONTENT) in the specified dimension
-* (GUIWIN_VSLIDER, GUIWIN_HSLIDER)
+* Scroll the content area (GEMTK_WM_AREA_CONTENT) in the specified dimension
+* (GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER)
* \param win The GUIWIN
-* \param orientation GUIWIN_VSLIDER or GUIWIN_HSLIDER
+* \param orientation GEMTK_WM_VSLIDER or GEMTK_WM_HSLIDER
* \param units the amout to scroll (pass negative values to scroll up)
* \param refresh Sliders will be updated when this flag is set
*/
-void guiwin_scroll(GUIWIN *win, short orientation, int units, bool refresh)
+void gemtk_wm_scroll(GUIWIN *win, short orientation, int units, bool refresh)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
int oldpos = 0, newpos = 0, vis_units=0, pix = 0;
int abs_pix = 0;
GRECT *redraw=NULL, g, g_ro;
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &g);
g_ro = g;
- if (orientation == GUIWIN_VSLIDER) {
+ if (orientation == GEMTK_WM_VSLIDER) {
pix = units*slid->y_unit_px;
abs_pix = abs(pix);
oldpos = slid->y_pos;
@@ -803,7 +803,7 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
if(oldpos == newpos)
return;
- if (units>=vis_units || guiwin_has_intersection(win, &g_ro)) {
+ if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) {
// send complete redraw
redraw = &g_ro;
} else {
@@ -839,7 +839,7 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
if(oldpos == newpos)
return;
- if (units>=vis_units || guiwin_has_intersection(win, &g_ro)) {
+ if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) {
// send complete redraw
redraw = &g_ro;
} else {
@@ -864,36 +864,36 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
}
if (refresh) {
- guiwin_update_slider(win, orientation);
+ gemtk_wm_update_slider(win, orientation);
}
if ((redraw != NULL) && (redraw->g_h > 0)) {
- guiwin_send_redraw(win, redraw);
+ gemtk_wm_send_redraw(win, redraw);
}
}
/**
* Refresh the sliders of the window.
* \param win the GUIWIN
-* \param mode bitmask, valid bits: GUIWIN_VSLIDER, GUIWIN_HSLIDER
+* \param mode bitmask, valid bits: GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER
*/
-bool guiwin_update_slider(GUIWIN *win, short mode)
+bool gemtk_wm_update_slider(GUIWIN *win, short mode)
{
GRECT viewport;
- struct guiwin_scroll_info_s * slid;
+ struct gemtk_wm_scroll_info_s * slid;
unsigned long size, pos;
int old_x, old_y;
- short handle = guiwin_get_handle(win);
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &viewport);
- slid = guiwin_get_scroll_info(win);
+ short handle = gemtk_wm_get_handle(win);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &viewport);
+ slid = gemtk_wm_get_scroll_info(win);
old_x = slid->x_pos;
old_y = slid->y_pos;
// TODO: check if the window has sliders of that direction...?
- if((mode & GUIWIN_VSLIDER) && (slid->y_unit_px > 0)) {
+ if((mode & GEMTK_WM_VSLIDER) && (slid->y_unit_px > 0)) {
if ( slid->y_units < (long)viewport.g_h/slid->y_unit_px) {
size = 1000L;
} else
@@ -910,7 +910,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
wind_set(handle, WF_VSLIDE, 0, 0, 0, 0);
}
}
- if((mode & GUIWIN_HSLIDER) && (slid->x_unit_px > 0)) {
+ if((mode & GEMTK_WM_HSLIDER) && (slid->x_unit_px > 0)) {
if ( slid->x_units < (long)viewport.g_w/slid->x_unit_px)
size = 1000L;
else
@@ -937,7 +937,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
/**
* Return the AES handle for the GUIWIN.
*/
-short guiwin_get_handle(GUIWIN *win)
+short gemtk_wm_get_handle(GUIWIN *win)
{
return(win->handle);
}
@@ -945,7 +945,7 @@ short guiwin_get_handle(GUIWIN *win)
/**
* Return the VDI handle for an GUIWIN.
*/
-VdiHdl guiwin_get_vdi_handle(GUIWIN *win)
+VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win)
{
return(v_vdi_h);
}
@@ -953,7 +953,7 @@ VdiHdl guiwin_get_vdi_handle(GUIWIN *win)
/**
* Returns the state bitmask of the window
*/
-uint32_t guiwin_get_state(GUIWIN *win)
+uint32_t gemtk_wm_get_state(GUIWIN *win)
{
return(win->state);
}
@@ -962,7 +962,7 @@ uint32_t guiwin_get_state(GUIWIN *win)
/**
* Set and new event handler function.
*/
-void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f cb)
+void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb)
{
win->handler_func = cb;
}
@@ -976,13 +976,13 @@ void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f
cb)
* \param flags optional configuration flags
*/
//TODO: document flags
-void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, uint32_t flags)
+void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, uint32_t flags)
{
win->toolbar = toolbar;
win->toolbar_idx = idx;
win->toolbar_edit_obj = -1;
- if (flags & GW_FLAG_HAS_VTOOLBAR) {
- win->flags |= GW_FLAG_HAS_VTOOLBAR;
+ if (flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
+ win->flags |= GEMTK_WM_FLAG_HAS_VTOOLBAR;
win->toolbar_size = win->toolbar[idx].ob_width;
}
else {
@@ -992,9 +992,9 @@ void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
uint32_t flags)
/** Update width/height of the toolbar region
* \param win the GUIWIN
-* \param s depending on the flag GW_FLAG_HAS_VTOOLBAR this is the width or the height
+* \param s depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this is the width or the
height
*/
-void guiwin_set_toolbar_size(GUIWIN *win, uint16_t s)
+void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s)
{
win->toolbar_size = s;
}
@@ -1004,7 +1004,7 @@ void guiwin_set_toolbar_size(GUIWIN *win, uint16_t s)
* \param win the GUIWIN
* \param func the custom redraw function
*/
-void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f func)
+void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func)
{
win->toolbar_redraw_func = func;
}
@@ -1012,7 +1012,7 @@ void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f
func)
/**
* Attach an arbitary pointer to the GUIWIN
*/
-void guiwin_set_user_data(GUIWIN *win, void *data)
+void gemtk_wm_set_user_data(GUIWIN *win, void *data)
{
win->user_data = data;
}
@@ -1020,14 +1020,14 @@ void guiwin_set_user_data(GUIWIN *win, void *data)
/**
* Retrieve the user_data pointer attached to the GUIWIN.
*/
-void *guiwin_get_user_data(GUIWIN *win)
+void *gemtk_wm_get_user_data(GUIWIN *win)
{
return(win->user_data);
}
/** Get the scroll management structure for a GUIWIN
*/
-struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win) {
+struct gemtk_wm_scroll_info_s *gemtk_wm_get_scroll_info(GUIWIN *win) {
return(&win->scroll_info);
}
@@ -1035,9 +1035,9 @@ struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win) {
* Get the amount of content dimensions within the window
* which is calculated by using the scroll_info attached to the GUIWIN.
*/
-void guiwin_set_scroll_grid(GUIWIN * win, short x, short y)
+void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
assert(slid != NULL);
@@ -1051,9 +1051,9 @@ void guiwin_set_scroll_grid(GUIWIN * win, short x, short y)
* \param x horizontal size
* \param y vertical size
*/
-void guiwin_set_content_units(GUIWIN * win, short x, short y)
+void gemtk_wm_set_content_units(GUIWIN * win, short x, short y)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
assert(slid != NULL);
@@ -1069,7 +1069,7 @@ void guiwin_set_content_units(GUIWIN * win, short x, short y)
* \param c the 6th parameter to appl_write
* \param d the 7th parameter to appl_write
*/
-void guiwin_send_msg(GUIWIN *win, short msg_type, short a, short b, short c,
+void gemtk_wm_send_msg(GUIWIN *win, short msg_type, short a, short b, short c,
short d)
{
short msg[8];
@@ -1086,8 +1086,8 @@ void guiwin_send_msg(GUIWIN *win, short msg_type, short a, short b,
short c,
appl_write(gl_apid, 16, &msg);
}
-// TODO: rename, document and implement alternative (guiwin_exec_event)
-void guiwin_send_redraw(GUIWIN *win, GRECT *area)
+// TODO: rename, document and implement alternative (gemtk_wm_exec_event)
+void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area)
{
short msg[8], retval;
GRECT work;
@@ -1107,10 +1107,10 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
EVMULT_OUT event_out;
if (area == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &work);
if (work.g_w < 1 || work.g_h < 1) {
if (win->toolbar != NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_TOOLBAR, &work);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &work);
if (work.g_w < 1 || work.g_h < 1) {
return;
}
@@ -1130,7 +1130,7 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
event_out.emo_events = MU_MESAG;
retval = preproc_wm(win, &event_out, msg);
- if (retval == 0 || (win->flags & GW_FLAG_PREPROC_WM) != 0){
+ if (retval == 0 || (win->flags & GEMTK_WM_FLAG_PREPROC_WM) != 0){
win->handler_func(win, &event_out, msg);
}
@@ -1141,7 +1141,7 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
/** Attach an AES FORM to the GUIWIN, similar feature like the toolbar
*/
-void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index)
+void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index)
{
DEBUG_PRINT(("Setting form %p (%d) for window %p\n", tree, index, win));
win->form = tree;
@@ -1152,13 +1152,13 @@ void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index)
/** Checks if a GUIWIN is overlapped by other windows.
*/
-bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
+bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work)
{
GRECT area, mywork;
bool retval = true;
if (work == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &mywork);
work = &mywork;
}
@@ -1178,11 +1178,11 @@ bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
* \param msg specifies the AES message which initiated the redraw, or 0 when
* the function was called without AES message context.
*/
-void guiwin_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
+void gemtk_wm_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
{
GRECT tb_area, tb_area_ro, g;
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area_ro);
if(clip == NULL) {
clip = &tb_area_ro;
@@ -1222,19 +1222,19 @@ void guiwin_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
/** Execute FORM redraw
*/
-void guiwin_form_redraw(GUIWIN *gw, GRECT *clip)
+void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip)
{
GRECT area, area_ro, g;
int scroll_px_x, scroll_px_y;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
//int new_x, new_y, old_x, old_y;
short edit_idx;
- DEBUG_PRINT(("guiwin_form_redraw\n"));
+ DEBUG_PRINT(("gemtk_wm_form_redraw\n"));
// calculate form coordinates, include scrolling:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &area_ro);
- slid = guiwin_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &area_ro);
+ slid = gemtk_wm_get_scroll_info(gw);
// Update form position:
gw->form[gw->form_idx].ob_x = area_ro.g_x - (slid->x_pos *
slid->x_unit_px);
@@ -1264,19 +1264,19 @@ void guiwin_form_redraw(GUIWIN *gw, GRECT *clip)
/** Fill the content area with white color
*/
-void guiwin_clear(GUIWIN *win)
+void gemtk_wm_clear(GUIWIN *win)
{
GRECT area, g;
short pxy[4];
VdiHdl vh;
- vh = guiwin_get_vdi_handle(win);
+ vh = gemtk_wm_get_vdi_handle(win);
- if(win->state & GW_STATUS_ICONIFIED) {
+ if(win->state & GEMTK_WM_STATUS_ICONIFIED) {
// also clear the toolbar area when iconified:
- guiwin_get_grect(win, GUIWIN_AREA_WORK, &area);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &area);
} else {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &area);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &area);
}
vsf_interior(vh, FIS_SOLID);
diff --git a/atari/gemtk/msgbox.c b/atari/gemtk/msgbox.c
index 770e0af..150bcc7 100644
--- a/atari/gemtk/msgbox.c
+++ b/atari/gemtk/msgbox.c
@@ -8,9 +8,9 @@
# define min(x,y) ((x<y) ? x : y )
#endif
-short msg_box_show(short type, const char * msg)
+short gemtk_msg_box_show(short type, const char * msg)
{
- #define MSG_BOX_STR_SIZE 256
+ #define GEMTK_MSG_BOX_STR_SIZE 256
short retval=0, i=0, z=0, l=0;
char c;
int len_msg = strlen(msg);
@@ -19,13 +19,13 @@ short msg_box_show(short type, const char * msg)
const char *str_yes = "Yes";
const char *str_no = "No";
const char *str_ok = "OK";
- char msg_box_str[MSG_BOX_STR_SIZE];
+ char msg_box_str[GEMTK_MSG_BOX_STR_SIZE];
char *dst = msg_box_str;
- memset(msg_box_str, 0, MSG_BOX_STR_SIZE);
+ memset(msg_box_str, 0, GEMTK_MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "[1]", MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "[", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "[1]", GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "[", GEMTK_MSG_BOX_STR_SIZE);
dst = msg_box_str + strlen(msg_box_str);
@@ -61,24 +61,24 @@ short msg_box_show(short type, const char * msg)
dst++;
}
}
- strncat(msg_box_str, "][", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "][", GEMTK_MSG_BOX_STR_SIZE);
- if(type == MSG_BOX_CONFIRM){
- strncat(msg_box_str, str_yes, MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "|", MSG_BOX_STR_SIZE);
- strncat(msg_box_str, str_no, MSG_BOX_STR_SIZE);
+ if(type == GEMTK_MSG_BOX_CONFIRM){
+ strncat(msg_box_str, str_yes, GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "|", GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, str_no, GEMTK_MSG_BOX_STR_SIZE);
} else {
- strncat(msg_box_str, str_ok, MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, str_ok, GEMTK_MSG_BOX_STR_SIZE);
}
- strncat(msg_box_str, "]", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "]", GEMTK_MSG_BOX_STR_SIZE);
retval = form_alert(type, msg_box_str);
- if(type == MSG_BOX_CONFIRM){
+ if(type == GEMTK_MSG_BOX_CONFIRM){
if(retval != 1){
retval = 0;
}
}
return(retval);
- #undef MSG_BOX_STR_SIZE
+ #undef GEMTK_MSG_BOX_STR_SIZE
}
diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c
index 0584438..2558694 100644
--- a/atari/gemtk/objc.c
+++ b/atari/gemtk/objc.c
@@ -24,7 +24,7 @@
#include <assert.h>
#include "gemtk.h"
-char *get_text(OBJECT * tree, short idx)
+char *gemtk_obj_get_text(OBJECT * tree, short idx)
{
static char p[]="";
USERBLK *user;
@@ -91,7 +91,7 @@ char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt)
set_string(tree, idx, spare);
}
-OBJECT *get_tree(int idx)
+OBJECT *gemtk_obj_get_tree(int idx)
{
OBJECT *tree;
@@ -101,7 +101,7 @@ OBJECT *get_tree(int idx)
return tree;
}
-bool obj_is_inside(OBJECT * tree, short obj, GRECT *area)
+bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area)
{
GRECT obj_screen;
bool ret = false;
@@ -115,7 +115,7 @@ bool obj_is_inside(OBJECT * tree, short obj, GRECT *area)
return(ret);
}
-GRECT * obj_screen_rect(OBJECT * tree, short obj)
+GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj)
{
static GRECT obj_screen;
diff --git a/atari/gemtk/utils.c b/atari/gemtk/utils.c
index 1fb67c7..fae9d74 100644
--- a/atari/gemtk/utils.c
+++ b/atari/gemtk/utils.c
@@ -39,7 +39,7 @@ unsigned short _systype (void)
return _systype_v;
}
-bool rc_intersect_ro(GRECT *a, GRECT *b)
+bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b)
{
GRECT r1, r2;
@@ -56,7 +56,7 @@ typedef struct {
char *capslock;
} KEYTAB;
-int keybd2ascii( int keybd, int shift)
+int gemtk_keybd2ascii( int keybd, int shift)
{
KEYTAB *key;
diff --git a/atari/gui.c b/atari/gui.c
index fa56823..c957baf 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -164,7 +164,7 @@ void gui_poll(bool active)
aes_event_in.emi_m1.g_x = mx;
aes_event_in.emi_m1.g_y = my;
evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
- if(!guiwin_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
+ if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
LOG(("WM: %d\n", aes_msg_out[0]));
switch(aes_msg_out[0]) {
@@ -368,12 +368,12 @@ void gui_window_redraw_window(struct gui_window *gw)
void gui_window_update_box(struct gui_window *gw, const struct rect *rect)
{
GRECT area;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if (gw == NULL)
return;
- slid = guiwin_get_scroll_info(gw->root->win);
+ slid = gemtk_wm_get_scroll_info(gw->root->win);
window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
@@ -642,10 +642,10 @@ gui_window_set_search_ico(hlcache_handle *ico)
void gui_window_new_content(struct gui_window *w)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(w->root->win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
slid->x_pos = 0;
slid->y_pos = 0;
- guiwin_update_slider(w->root->win, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER);
gui_window_redraw_window(w);
}
@@ -835,7 +835,7 @@ void gui_quit(void)
urldb_save(nsoption_charp(url_file));
deskmenu_destroy();
- guiwin_exit();
+ gemtk_wm_exit();
rsrc_free();
@@ -972,7 +972,7 @@ static void gui_init(int argc, char** argv)
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
- cursors = get_tree(CURSOR);
+ cursors = gemtk_obj_get_tree(CURSOR);
create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
cursors, &gem_cursors.appstarting);
gem_set_cursor( &gem_cursors.appstarting );
@@ -1028,7 +1028,7 @@ static void gui_init2(int argc, char** argv)
if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
menu_register( _AESapid, (char*)" NetSurf ");
}
- guiwin_init();
+ gemtk_wm_init();
global_history_init();
hotlist_init();
toolbar_init();
diff --git a/atari/history.c b/atari/history.c
index 77df2c9..6d52c4e 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -63,18 +63,18 @@ void global_history_open( void )
pos.g_w = desk_area.g_w / 4;
pos.g_h = desk_area.g_h;
- wind_open(guiwin_get_handle(gl_history.window), pos.g_x, pos.g_y,
+ wind_open(gemtk_wm_get_handle(gl_history.window), pos.g_x, pos.g_y,
pos.g_w, pos.g_h);
gl_history.open = true;
atari_treeview_open(gl_history.tv);
} else {
- wind_set(guiwin_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
+ wind_set(gemtk_wm_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
}
}
void global_history_close( void )
{
- wind_close(guiwin_get_handle(gl_history.window));
+ wind_close(gemtk_wm_get_handle(gl_history.window));
gl_history.open = false;
atari_treeview_close(gl_history.tv);
}
@@ -111,7 +111,7 @@ bool global_history_init( void )
gl_history.open = false;
handle = wind_create(flags, 40, 40, desk_area.g_w, desk_area.g_h);
- gl_history.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ gl_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
if( gl_history.window == NULL ) {
LOG(("Failed to allocate history window"));
return( false );
@@ -144,8 +144,8 @@ void global_history_destroy( void )
history_global_cleanup();
if( gl_history.open )
global_history_close();
- wind_delete(guiwin_get_handle(gl_history.window));
- guiwin_remove(gl_history.window);
+ wind_delete(gemtk_wm_get_handle(gl_history.window));
+ gemtk_wm_remove(gl_history.window);
gl_history.window = NULL;
atari_treeview_destroy(gl_history.tv);
gl_history.init = false;
diff --git a/atari/hotlist.c b/atari/hotlist.c
index ccba088..ede5814 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -61,7 +61,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case WM_TOOLBAR:
- tv = (NSTREEVIEW) guiwin_get_user_data(win);
+ tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
@@ -74,7 +74,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_delete_selected();
- guiwin_send_redraw(tv->window, NULL);
+ gemtk_wm_send_redraw(tv->window, NULL);
break;
case TOOLBAR_HOTLIST_EDIT:
@@ -82,10 +82,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
break;
}
- get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, &tb_area);
+ gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
- guiwin_send_redraw(tv->window, &tb_area);
+ gemtk_wm_send_redraw(tv->window, &tb_area);
break;
case WM_CLOSED:
@@ -117,18 +117,18 @@ void hotlist_init(void)
int flags = ATARI_TREEVIEW_WIDGETS;
short handle = -1;
GRECT desk;
- OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
+ OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
assert( tree );
hl.open = false;
handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
- hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ hl.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
if( hl.window == NULL ) {
LOG(("Failed to allocate Hotlist"));
return;
}
wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
- guiwin_set_toolbar(hl.window, tree, 0, 0);
+ gemtk_wm_set_toolbar(hl.window, tree, 0, 0);
hl.tv = atari_treeview_create(
hotlist_get_tree_flags(),
hl.window,
@@ -169,17 +169,17 @@ void hotlist_open(void)
pos.g_w = desk_area.g_w / 4;
pos.g_h = desk_area.g_h;
- wind_open_grect(guiwin_get_handle(hl.window), &pos);
+ wind_open_grect(gemtk_wm_get_handle(hl.window), &pos);
hl.open = true;
atari_treeview_open( hl.tv );
} else {
- wind_set(guiwin_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
+ wind_set(gemtk_wm_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
}
}
void hotlist_close(void)
{
- wind_close(guiwin_get_handle(hl.window));
+ wind_close(gemtk_wm_get_handle(hl.window));
hl.open = false;
atari_treeview_close( hl.tv );
}
@@ -194,8 +194,8 @@ void hotlist_destroy(void)
hotlist_cleanup( (char*)&hl.path );
if (hl.open)
hotlist_close();
- wind_delete(guiwin_get_handle(hl.window));
- guiwin_remove(hl.window);
+ wind_delete(gemtk_wm_get_handle(hl.window));
+ gemtk_wm_remove(hl.window);
hl.window = NULL;
atari_treeview_destroy( hl.tv );
hl.init = false;
diff --git a/atari/login.c b/atari/login.c
index 0fad4cd..461a2f9 100755
--- a/atari/login.c
+++ b/atari/login.c
@@ -54,7 +54,7 @@ bool login_form_do(nsurl * url, char * realm, char ** out)
// TODO: use auth details for predefined login data
// auth = urldb_get_auth_details(url, realm);
- tree = get_tree(LOGIN);
+ tree = gemtk_obj_get_tree(LOGIN);
assert(tree != NULL);
diff --git a/atari/misc.c b/atari/misc.c
index d5837d7..1b4c3ea 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -61,13 +61,13 @@ void warn_user(const char *warning, const char *detail)
snprintf(message, len, messages_get(warning), detail);
printf("%s\n", message);
- msg_box_show(MSG_BOX_ALERT, message);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, message);
}
void die(const char *error)
{
printf("%s\n", error);
- msg_box_show(MSG_BOX_ALERT, error);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, error);
exit(1);
}
@@ -123,7 +123,7 @@ struct gui_window * find_guiwin_by_aes_handle(short handle){
while(gw != NULL) {
if( gw->root->win != NULL
- && guiwin_get_handle(gw->root->win) == handle ) {
+ && gemtk_wm_get_handle(gw->root->win) == handle ) {
return(gw);
}
else
diff --git a/atari/rootwin.c b/atari/rootwin.c
index 5acd417..44eec33 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -100,7 +100,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
static bool prev_url = false;
static short prev_x=0;
static short prev_y=0;
- struct rootwin_data_s * data = guiwin_get_user_data(win);
+ struct rootwin_data_s * data = gemtk_wm_get_user_data(win);
struct gui_window *tmp;
@@ -127,7 +127,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
tmp = window_list;
while(tmp != NULL){
if(tmp->root != data->rootwin){
- guiwin_send_msg(tmp->root->win, WM_TOPPED, 0, 0, 0, 0);
+ gemtk_wm_send_msg(tmp->root->win, WM_TOPPED, 0, 0, 0, 0);
break;
}
tmp = tmp->next;
@@ -230,7 +230,7 @@ int window_create(struct gui_window * gw,
bool tb, sb;
int flags;
struct rootwin_data_s *data;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
tb = (inflags & WIDGET_TOOLBAR);
sb = (inflags & WIDGET_STATUSBAR);
@@ -261,13 +261,13 @@ int window_create(struct gui_window * gw,
free(gw->root);
return( -1 );
}
- gw->root->win = guiwin_add(gw->root->aes_handle,
- GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM,
handle_event);
+ gw->root->win = gemtk_wm_add(gw->root->aes_handle,
+ GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM,
handle_event);
data = malloc(sizeof(struct rootwin_data_s));
data->rootwin = gw->root;
- guiwin_set_user_data(gw->root->win, (void*)data);
- slid = guiwin_get_scroll_info(gw->root->win);
+ gemtk_wm_set_user_data(gw->root->win, (void*)data);
+ slid = gemtk_wm_get_scroll_info(gw->root->win);
slid->y_unit_px = 32;
slid->x_unit_px = 32;
@@ -275,8 +275,8 @@ int window_create(struct gui_window * gw,
if(tb) {
gw->root->toolbar = toolbar_create(gw->root);
assert(gw->root->toolbar);
- guiwin_set_toolbar(gw->root->win, get_tree(TOOLBAR), 0, 0);
- guiwin_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb);
+ gemtk_wm_set_toolbar(gw->root->win, gemtk_obj_get_tree(TOOLBAR), 0, 0);
+ gemtk_wm_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb);
} else {
gw->root->toolbar = NULL;
}
@@ -346,8 +346,8 @@ int window_destroy(ROOTWIN *rootwin)
LOG(("%p", rootwin));
- if (guiwin_get_user_data(rootwin->win) != NULL) {
- free(guiwin_get_user_data(rootwin->win));
+ if (gemtk_wm_get_user_data(rootwin->win) != NULL) {
+ free(gemtk_wm_get_user_data(rootwin->win));
}
// make sure we do not destroy windows which have gui_windows attached:
@@ -368,7 +368,7 @@ int window_destroy(ROOTWIN *rootwin)
if(rootwin->title)
free(rootwin->title);
- guiwin_remove(rootwin->win);
+ gemtk_wm_remove(rootwin->win);
wind_close(rootwin->aes_handle);
wind_delete(rootwin->aes_handle);
free(rootwin);
@@ -391,7 +391,7 @@ void window_open(ROOTWIN *rootwin, struct gui_window *gw, GRECT pos)
if(rootwin->statusbar != NULL) {
sb_attach(rootwin->statusbar, rootwin->active_gui_window);
}
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, &g);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, &g);
toolbar_set_attached(rootwin->toolbar, true);
toolbar_set_dimensions(rootwin->toolbar, &g);
window_update_back_forward(rootwin);
@@ -415,14 +415,14 @@ void window_restore_active_gui_window(ROOTWIN *rootwin)
window_set_title(rootwin, gw->title);
if (gw->search != NULL) {
- nsatari_search_restore_form(gw->search, get_tree(TOOLBAR));
+ nsatari_search_restore_form(gw->search, gemtk_obj_get_tree(TOOLBAR));
window_open_search(rootwin, false);
} else {
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
}
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
- guiwin_set_toolbar_size(rootwin->win, tb_area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h);
window_update_back_forward(rootwin);
@@ -461,7 +461,7 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
{
int units;
GRECT content_area;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(root->win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(root->win);
if(sx < 0) {
sx = 0;
@@ -472,9 +472,9 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
int xunits = sx / slid->x_unit_px;
int yunits = sy / slid->y_unit_px;
- guiwin_scroll(root->win, GUIWIN_VSLIDER, yunits - slid->y_pos, false);
- guiwin_scroll(root->win, GUIWIN_HSLIDER, xunits - slid->x_pos, false);
- guiwin_update_slider(root->win, GUIWIN_VH_SLIDER);
+ gemtk_wm_scroll(root->win, GEMTK_WM_VSLIDER, yunits - slid->y_pos, false);
+ gemtk_wm_scroll(root->win, GEMTK_WM_HSLIDER, xunits - slid->x_pos, false);
+ gemtk_wm_update_slider(root->win, GEMTK_WM_VH_SLIDER);
}
/**
@@ -484,7 +484,7 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
void window_set_content_size(ROOTWIN *rootwin, int width, int height)
{
GRECT area;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(rootwin->win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(rootwin->win);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
@@ -494,7 +494,7 @@ void window_set_content_size(ROOTWIN *rootwin, int width, int height)
slid->x_pos = 0;
if(slid->y_units < slid->y_pos)
slid->y_pos = 0;
- guiwin_update_slider(rootwin->win, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(rootwin->win, GEMTK_WM_VH_SLIDER);
}
/* set focus to an arbitary element */
@@ -556,7 +556,7 @@ void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp )
/* redraw window when it is iconyfied: */
if (rootwin->icon != NULL) {
short info, dummy;
- if (guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED) {
+ if (gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
window_redraw_favicon(rootwin, NULL);
}
}
@@ -590,9 +590,9 @@ struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin) {
void window_get_scroll(ROOTWIN *rootwin, int *x, int *y)
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
*x = slid->x_pos * slid->x_unit_px;
*y = slid->y_pos * slid->y_unit_px;
@@ -607,14 +607,14 @@ void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which,
GRECT *d)
d->g_h = 0;
if (which == BROWSER_AREA_TOOLBAR) {
- // guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, d);
+ // gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, d);
toolbar_get_grect(rootwin->toolbar, 0, d);
} else if (which == BROWSER_AREA_CONTENT) {
GRECT tb_area;
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, d);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, d);
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
d->g_y += tb_area.g_h;
@@ -658,7 +658,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
- obj = get_tree(TOOLBAR);
+ obj = gemtk_obj_get_tree(TOOLBAR);
if (init == false) {
obj[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
@@ -673,7 +673,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, true);
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area);
- guiwin_set_toolbar_size(rootwin->win, area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
window_get_grect(rootwin, BROWSER_AREA_SEARCH, &area);
window_schedule_redraw_grect(rootwin, &area);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
@@ -692,7 +692,7 @@ void window_close_search(ROOTWIN *rootwin)
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
- obj = get_tree(TOOLBAR);
+ obj = gemtk_obj_get_tree(TOOLBAR);
if (gw->search != NULL) {
nsatari_search_session_destroy(gw->search);
@@ -703,7 +703,7 @@ void window_close_search(ROOTWIN *rootwin)
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area);
- guiwin_set_toolbar_size(rootwin->win, area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
browser_window_reformat(bw, false, area.g_w, area.g_h);
}
@@ -719,8 +719,8 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip)
//printf("window_redraw_favicon: root: %p, win: %p\n", rootwin,
rootwin->win);
- guiwin_clear(rootwin->win);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_clear(rootwin->win);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if (clip == NULL) {
clip = &work;
@@ -732,7 +732,7 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip)
if (rootwin->icon == NULL) {
//printf("window_redraw_favicon OBJCTREE\n");
- OBJECT * tree = get_tree(ICONIFY);
+ OBJECT * tree = gemtk_obj_get_tree(ICONIFY);
tree->ob_x = work.g_x;
tree->ob_y = work.g_y;
tree->ob_width = work.g_w;
@@ -766,7 +766,7 @@ void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
//dbg_grect("window_schedule_redraw_grect input ", area);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if(!rc_intersect(area, &work))
return;
@@ -777,7 +777,7 @@ void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
GRECT *clip,
- struct guiwin_scroll_info_s * slid,
+ struct gemtk_wm_scroll_info_s * slid,
struct browser_window *bw)
{
@@ -834,13 +834,13 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int
content_x,
int content_y, int h, GRECT *work)
{
struct s_caret *caret = &rootwin->caret;
- VdiHdl vh = guiwin_get_vdi_handle(rootwin->win);
+ VdiHdl vh = gemtk_wm_get_vdi_handle(rootwin->win);
short pxy[8];
GRECT mywork, caret_pos;
MFDB screen;
int i, scroll_x, scroll_y;
uint16_t *fd_addr;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
short colors[2] = {G_BLACK, G_WHITE};
bool render_required = false;
@@ -857,7 +857,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &mywork);
work = &mywork;
}
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
scroll_x = slid->x_pos * slid->x_unit_px;
scroll_y = slid->y_pos * slid->y_unit_px;
@@ -965,7 +965,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
exit:
// disable clipping:
- vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy);
+ vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy);
}
void window_process_redraws(ROOTWIN * rootwin)
@@ -975,14 +975,14 @@ void window_process_redraws(ROOTWIN * rootwin)
short scroll_x=0, scroll_y=0;
bool toolbar_rdrw_required;
bool caret_rdrw_required = false;
- struct guiwin_scroll_info_s *slid =NULL;
+ struct gemtk_wm_scroll_info_s *slid =NULL;
int caret_h = 0;
struct s_caret *caret = &rootwin->caret;
redraw_active = true;
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
- //guiwin_set_toolbar_size(rootwin->win, tb_area.g_h);
+ //gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area);
//dbg_grect("content area", &content_area);
@@ -1001,8 +1001,8 @@ void window_process_redraws(ROOTWIN * rootwin)
pxy_clip[0] = tb_area.g_y;
pxy_clip[0] = pxy_clip[0] + tb_area.g_w + content_area.g_w - 1;
pxy_clip[0] = pxy_clip[1] + tb_area.g_h + content_area.g_h - 1;
- vs_clip(guiwin_get_vdi_handle(rootwin->win), 1, pxy_clip);
- //guiwin_clear(rootwin->win);
+ vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 1, pxy_clip);
+ //gemtk_wm_clear(rootwin->win);
*/
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible_ro);
while (visible_ro.g_w > 0 && visible_ro.g_h > 0) {
@@ -1031,7 +1031,7 @@ void window_process_redraws(ROOTWIN * rootwin)
if (rc_intersect(&content_area, &rdrw_area)) {
if(slid == NULL) {
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
scroll_x = slid->x_pos * slid->x_unit_px;
scroll_y = slid->y_pos * slid->y_unit_px;
@@ -1051,7 +1051,7 @@ void window_process_redraws(ROOTWIN * rootwin)
caret_pos.g_w = caret->dimensions.g_w;
caret_pos.g_h = caret->dimensions.g_h;
- if (rc_intersect_ro(&caret_pos, &content_area)) {
+ if (gemtk_rc_intersect_ro(&caret_pos, &content_area)) {
caret_rdrw_required = true;
}
}
@@ -1063,7 +1063,7 @@ void window_process_redraws(ROOTWIN * rootwin)
// disable clipping:
- //vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy_clip);
+ //vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy_clip);
if (caret_rdrw_required && ((rootwin->caret.state &
CARET_STATE_ENABLED)!=0)) {
@@ -1089,7 +1089,7 @@ void window_process_redraws(ROOTWIN * rootwin)
static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area)
{
int mx, my, sx, sy;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
struct gui_window *gw;
struct browser_window *bw;
@@ -1097,7 +1097,7 @@ static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT
*content_area)
mx = aes_event_out.emo_mouse.p_x - content_area->g_x;
my = aes_event_out.emo_mouse.p_y - content_area->g_y;
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
gw = window_get_active_gui_window(rootwin);
bw = gw->browser->bw;
@@ -1114,7 +1114,7 @@ static bool on_content_mouse_click(ROOTWIN *rootwin)
GRECT cwork;
browser_mouse_state bmstate = 0;
struct gui_window *gw;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
gw = window_get_active_gui_window(rootwin);
if(input_window != gw) {
@@ -1147,7 +1147,7 @@ static bool on_content_mouse_click(ROOTWIN *rootwin)
}
/* convert component coords to scrolled content coords: */
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
int sx_origin = mx;
int sy_origin = my;
@@ -1245,49 +1245,49 @@ static bool on_content_keypress(struct browser_window *bw,
unsigned short nkc)
GUIWIN * w = bw->window->root->win;
window_get_grect(bw->window->root, BROWSER_AREA_CONTENT, &g);
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(w);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w);
switch( ik ) {
case KEY_LINE_START:
- guiwin_scroll(w, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px),
false);
break;
case KEY_LINE_END:
- guiwin_scroll(w, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px),
false);
break;
case KEY_PAGE_UP:
- guiwin_scroll(w, GUIWIN_VSLIDER, (g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px),
false);
break;
case KEY_PAGE_DOWN:
- guiwin_scroll(w, GUIWIN_VSLIDER, (g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px),
false);
break;
case KEY_RIGHT:
- guiwin_scroll(w, GUIWIN_HSLIDER, -1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -1, false);
break;
case KEY_LEFT:
- guiwin_scroll(w, GUIWIN_HSLIDER, 1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, 1, false);
break;
case KEY_UP:
- guiwin_scroll(w, GUIWIN_VSLIDER, -1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, -1, false);
break;
case KEY_DOWN:
- guiwin_scroll(w, GUIWIN_VSLIDER, 1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, 1, false);
break;
default:
break;
}
- guiwin_update_slider(w, GUIWIN_VSLIDER|GUIWIN_HSLIDER);
+ gemtk_wm_update_slider(w, GEMTK_WM_VSLIDER|GEMTK_WM_HSLIDER);
}
}
@@ -1332,7 +1332,7 @@ static void on_redraw(ROOTWIN *rootwin, short msg[8])
//dbg_grect("on_redraw", &clip);
- if(guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED) {
+ if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
GRECT clip = {msg[4], msg[5], msg[6], msg[7]};
window_redraw_favicon(rootwin, &clip);
} else {
@@ -1356,7 +1356,7 @@ static void on_resized(ROOTWIN *rootwin)
return;
wind_get_grect(rootwin->aes_handle, WF_CURRXYWH, &g);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if (rootwin->loc.g_w != g.g_w || rootwin->loc.g_h != g.g_h) {
@@ -1398,22 +1398,22 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
if( gw == NULL )
return;
- if(guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED)
+ if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED)
return;
- dd_hdl = ddopen( msg[7], DD_OK);
+ dd_hdl = gemtk_dd_open( msg[7], DD_OK);
if( dd_hdl<0)
return; /* pipe not open */
memset( ext, 0, 32);
strcpy( ext, "ARGS");
- dd_msg = ddsexts( dd_hdl, ext);
+ dd_msg = gemtk_dd_sexts( dd_hdl, ext);
if( dd_msg<0)
goto error;
- dd_msg = ddrtry( dd_hdl, (char*)&name[0], (char*)&file[0],
(char*)&ext[0], &size);
+ dd_msg = gemtk_dd_rtry( dd_hdl, (char*)&name[0], (char*)&file[0],
(char*)&ext[0], &size);
if( size+1 >= PATH_MAX )
goto error;
if( !strncmp( ext, "ARGS", 4) && dd_msg > 0) {
- ddreply(dd_hdl, DD_OK);
+ gemtk_dd_reply(dd_hdl, DD_OK);
buff = (char*)malloc(sizeof(char)*(size+1));
if (buff != NULL) {
if (Fread(dd_hdl, size, buff ) == size)
@@ -1454,7 +1454,7 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
}
}
error:
- ddclose( dd_hdl);
+ gemtk_dd_close( dd_hdl);
}
static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip)
@@ -1462,7 +1462,7 @@ static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT
*clip)
struct rootwin_data_s * ud;
if (msg != WM_REDRAW) {
- ud = guiwin_get_user_data(win);
+ ud = gemtk_wm_get_user_data(win);
assert(ud);
diff --git a/atari/rootwin.h b/atari/rootwin.h
index 3be8ecf..d2cd04a 100755
--- a/atari/rootwin.h
+++ b/atari/rootwin.h
@@ -21,7 +21,7 @@
#include <atari/gui.h>
-#define GUIWIN_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
+#define GEMTK_WM_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
#define GEMWIN_VISIBLE(win) (win->status & WS_OPEN)
#define WIDGET_STATUSBAR 0x1
diff --git a/atari/search.c b/atari/search.c
index 8569548..0246250 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -147,7 +147,7 @@ static int apply_form(OBJECT *obj, struct s_search_form_state *s)
if( (obj[TOOLBAR_CB_SHOWALL].ob_state & OS_SELECTED) != 0 )
s->flags |= SEARCH_FLAG_SHOWALL;
- cstr = get_text(obj, TOOLBAR_TB_SRCH);
+ cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH);
snprintf(s->text, 32, "%s", cstr);
return ( 0 );
@@ -222,7 +222,7 @@ static bool search_session_compare(struct s_search_form_session *s,
OBJECT *obj)
}
char * cstr;
- cstr = get_text(obj, TOOLBAR_TB_SRCH);
+ cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH);
if (cstr != NULL){
if (strcmp(cstr, (char*)&s->state.text) != 0) {
return (true);
@@ -257,9 +257,9 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT
*obj,
s->state.flags &= (~SEARCH_FLAG_FORWARDS);
if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){
- LOG(("searching for: %s\n", get_text(obj, TOOLBAR_TB_SRCH)));
+ LOG(("searching for: %s\n", gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH)));
browser_window_search_step(s->bw, s->state.flags,
- get_text(obj, TOOLBAR_TB_SRCH));
+ gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH));
}
}
diff --git a/atari/settings.c b/atari/settings.c
index 546f56a..d46de47 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -46,16 +46,16 @@ static OBJECT * dlgtree;
#define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED));
-#define OBJ_REDRAW(idx) guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+#define OBJ_REDRAW(idx) gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \
- guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+ gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)); \
- guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+ gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define FORMEVENT(idx) form_event(idx, 0);
@@ -181,21 +181,21 @@ static void display_settings(void)
set_text( SETTINGS_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver),
LABEL_FONT_RENDERER_MAX_LEN );
SET_BIT(dlgtree[SETTINGS_CB_TRANSPARENCY].ob_state,
- GW_CB_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
+ OS_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_ENABLE_ANIMATION].ob_state,
- GW_CB_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_FG_IMAGES].ob_state,
- GW_CB_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_BG_IMAGES].ob_state,
- GW_CB_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
// TODO: enable this option?
/* SET_BIT(dlgtree[SETTINGS_CB_INCREMENTAL_REFLOW].ob_state,
- GW_CB_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );*/
+ OS_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );*/
SET_BIT(dlgtree[SETTINGS_CB_ANTI_ALIASING].ob_state,
- GW_CB_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
+ OS_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
// TODO: activate this option?
@@ -221,9 +221,9 @@ static void display_settings(void)
set_text( SETTINGS_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass),
INPUT_PROXY_PASSWORD_MAX_LEN );
SET_BIT(dlgtree[SETTINGS_CB_USE_PROXY].ob_state,
- GW_CB_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_PROXY_AUTH].ob_state,
- GW_CB_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
+ OS_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles);
snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) );
@@ -320,7 +320,7 @@ static void form_event(int index, int external)
if( external ) {
objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y);
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_FONT_RENDERER);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_FONT_RENDERER);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_FONT_RENDERER_INTERNAL;
pop_menu.mn_scroll = SCROLL_NO;
@@ -329,7 +329,7 @@ static void form_event(int index, int external)
// find the selected menu item and uncheck others:
for(i=pop_menu.mn_item; i<=num_font_drivers; i++) {
get_string(pop_menu.mn_tree, i, spare);
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
if (strcasecmp(&spare[2], tmp)) {
menu_icheck(pop_menu.mn_tree, i, 0);
} else {
@@ -351,7 +351,7 @@ static void form_event(int index, int external)
OBJ_REDRAW(SETTINGS_BT_SEL_FONT_RENDERER);
}
}
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
if (strcasecmp(tmp, "freetype") == 0) {
ENABLE_OBJ(SETTINGS_CB_ANTI_ALIASING);
} else {
@@ -363,7 +363,7 @@ static void form_event(int index, int external)
objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y);
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_LANGUAGE);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_LANGUAGE);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_LANGUAGE_CS;
pop_menu.mn_scroll = SCROLL_NO;
@@ -372,7 +372,7 @@ static void form_event(int index, int external)
// find the selected menu item and uncheck others:
for(i=pop_menu.mn_item; i<=num_locales; i++) {
get_string(pop_menu.mn_tree, i, spare);
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_LOCALE);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE);
if (strcasecmp(&spare[2], tmp)) {
menu_icheck(pop_menu.mn_tree, i, 0);
} else {
@@ -586,19 +586,19 @@ static void apply_settings(void)
nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
}
nsoption_set_charp(http_proxy_auth_pass,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD));
nsoption_set_charp(http_proxy_auth_user,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME));
nsoption_set_charp(http_proxy_host,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST));
nsoption_set_int(http_proxy_port,
- atoi( get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) ));
+ atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) ));
nsoption_set_int(max_fetchers_per_host,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS_PER_HOST)));
+ atoi( gemtk_obj_get_text(dlgtree,
SETTINGS_EDIT_MAX_FETCHERS_PER_HOST)));
nsoption_set_int(max_cached_fetch_handles,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_CACHED_CONNECTIONS)));
+ atoi( gemtk_obj_get_text(dlgtree,
SETTINGS_EDIT_MAX_CACHED_CONNECTIONS)));
nsoption_set_int(max_fetchers,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) ));
+ atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) ));
nsoption_set_bool(foreground_images,
OBJ_SELECTED( SETTINGS_CB_FG_IMAGES ));
nsoption_set_bool(background_images,
@@ -610,7 +610,7 @@ static void apply_settings(void)
/* "Rendering" tab: */
nsoption_set_charp(atari_font_driver,
- get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER));
+ gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER));
nsoption_set_bool(atari_transparency,
OBJ_SELECTED(SETTINGS_CB_TRANSPARENCY));
nsoption_set_bool(animate_images,
@@ -625,17 +625,17 @@ static void apply_settings(void)
/* "Paths" tabs: */
nsoption_set_charp(ca_bundle,
- get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE));
nsoption_set_charp(ca_path,
- get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
nsoption_set_charp(homepage_url,
- get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
nsoption_set_charp(hotlist_file,
- get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE));
nsoption_set_charp(atari_editor,
- get_text(dlgtree, SETTINGS_EDIT_EDITOR));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_EDITOR));
nsoption_set_charp(downloads_path,
- get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH));
/* "Cache" tab: */
nsoption_set_int(memory_cache_size,
@@ -647,15 +647,15 @@ static void apply_settings(void)
nsoption_set_bool(block_ads,
OBJ_SELECTED(SETTINGS_CB_HIDE_ADVERTISEMENT));
nsoption_set_charp(accept_language,
- get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
nsoption_set_int(expire_url,
- atoi(get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE)));
+ atoi(gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE)));
nsoption_set_bool(send_referer,
OBJ_SELECTED(SETTINGS_CB_SEND_HTTP_REFERRER));
nsoption_set_bool(do_not_track,
OBJ_SELECTED(SETTINGS_CB_SEND_DO_NOT_TRACK));
nsoption_set_charp(homepage_url,
- get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE));
}
static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
@@ -663,7 +663,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
short retval = 0;
GRECT clip, work;
static short edit_idx = 0;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -678,7 +678,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
break;
case WM_SIZED:
- guiwin_update_slider(win, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(win, GEMTK_WM_VH_SLIDER);
break;
case WM_MOVED:
@@ -691,7 +691,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
}
break;
- case GUIWIN_WM_FORM:
+ case GEMTK_WM_WM_FORM:
form_event(msg[4], 1);
break;
@@ -714,18 +714,18 @@ void open_settings(void)
if (h_aes_win == 0) {
GRECT curr, area;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
uint32_t kind = CLOSER | NAME | MOVER | VSLIDE | HSLIDE | UPARROW
| DNARROW | LFARROW | RTARROW | SIZER | FULLER;
- dlgtree = get_tree(SETTINGS);
+ dlgtree = gemtk_obj_get_tree(SETTINGS);
area.g_x = area.g_y = 0;
area.g_w = MIN(dlgtree->ob_width, desk_area.g_w);
area.g_h = MIN(dlgtree->ob_height, desk_area.g_h);
wind_calc_grect(WC_BORDER, kind, &area, &area);
h_aes_win = wind_create_grect(kind, &area);
wind_set_str(h_aes_win, WF_NAME, "Settings");
- settings_guiwin = guiwin_add(h_aes_win, GW_FLAG_DEFAULTS,
+ settings_guiwin = gemtk_wm_add(h_aes_win, GEMTK_WM_FLAG_DEFAULTS,
on_aes_event);
curr.g_w = MIN(dlgtree->ob_width, desk_area.g_w);
curr.g_h = MIN(dlgtree->ob_height, desk_area.g_h-64);
@@ -742,22 +742,22 @@ void open_settings(void)
wind_open_grect(h_aes_win, &curr);
- guiwin_set_form(settings_guiwin, dlgtree, 0);
- guiwin_set_scroll_grid(settings_guiwin, 32, 32);
- guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &area);
+ gemtk_wm_set_form(settings_guiwin, dlgtree, 0);
+ gemtk_wm_set_scroll_grid(settings_guiwin, 32, 32);
+ gemtk_wm_get_grect(settings_guiwin, GEMTK_WM_AREA_CONTENT, &area);
- slid = guiwin_get_scroll_info(settings_guiwin);
- guiwin_set_content_units(settings_guiwin,
+ slid = gemtk_wm_get_scroll_info(settings_guiwin);
+ gemtk_wm_set_content_units(settings_guiwin,
(dlgtree->ob_width/slid->x_unit_px),
(dlgtree->ob_height/slid->y_unit_px));
- guiwin_update_slider(settings_guiwin, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(settings_guiwin, GEMTK_WM_VH_SLIDER);
}
}
void close_settings(void)
{
LOG((""));
- guiwin_remove(settings_guiwin);
+ gemtk_wm_remove(settings_guiwin);
settings_guiwin = NULL;
wind_close(h_aes_win);
wind_delete(h_aes_win);
diff --git a/atari/statusbar.c b/atari/statusbar.c
index d43ebc8..9f26d7b 100755
--- a/atari/statusbar.c
+++ b/atari/statusbar.c
@@ -220,7 +220,7 @@ void sb_destroy( CMP_STATUSBAR s )
void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw)
{
- sb->aes_win = guiwin_get_handle(gw->root->win);
+ sb->aes_win = gemtk_wm_get_handle(gw->root->win);
sb->attached = true;
}
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 6afb660..a4a1ed3 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -232,8 +232,8 @@ void toolbar_init( void )
{
static USERBLK userblk;
- aes_toolbar = get_tree(TOOLBAR);
- throbber_form = get_tree(THROBBER);
+ aes_toolbar = gemtk_obj_get_tree(TOOLBAR);
+ throbber_form = gemtk_obj_get_tree(THROBBER);
userblk.ub_code = toolbar_url_userdraw;
userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
@@ -777,7 +777,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
}
else if (obj==TOOLBAR_BT_SEARCH_FWD) {
gw = tb->owner->active_gui_window;
- toolbar_tree = get_tree(TOOLBAR);
+ toolbar_tree = gemtk_obj_get_tree(TOOLBAR);
assert(gw->search);
nsatari_search_perform(gw->search, toolbar_tree, SEARCH_FLAG_FORWARDS);
}
diff --git a/atari/treeview.c b/atari/treeview.c
index e865de5..8d5520e 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -75,7 +75,7 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- NSTREEVIEW tv = (NSTREEVIEW) guiwin_get_user_data(win);
+ NSTREEVIEW tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
// handle message
@@ -142,13 +142,13 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
short msg[8])
{
GRECT work, clip;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( tv == NULL )
return;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
clip = work;
if ( !rc_intersect( (GRECT*)&msg[4], &clip ) ) return;
@@ -174,15 +174,15 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
short msg[8])
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
GRECT work;
short mx, my;
if(tv == NULL)
return;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
mx = ev_out->emo_mouse.p_x;
my = ev_out->emo_mouse.p_y;
@@ -261,9 +261,9 @@ static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
}
NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func)
+ gemtk_wm_event_handler_f user_func)
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( win == NULL )
return( NULL );
@@ -279,10 +279,10 @@ NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
new->window = win;
new->user_func = user_func;
- guiwin_set_event_handler(win, handle_event);
- guiwin_set_user_data(win, (void*)new);
+ gemtk_wm_set_event_handler(win, handle_event);
+ gemtk_wm_set_user_data(win, (void*)new);
- slid = guiwin_get_scroll_info(new->window);
+ slid = gemtk_wm_get_scroll_info(new->window);
slid->y_unit_px = 16;
slid->x_unit_px = 16;
@@ -319,13 +319,13 @@ void atari_treeview_destroy( NSTREEVIEW tv )
bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
{
GRECT work;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( tv == NULL )
return ( false );
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px);
int ry = (y-work.g_y)+(slid->y_pos*slid->y_unit_px);
@@ -347,11 +347,11 @@ void atari_treeview_redraw( NSTREEVIEW tv)
short todo[4];
GRECT work;
- short handle = guiwin_get_handle(tv->window);
- struct guiwin_scroll_info_s *slid;
+ short handle = gemtk_wm_get_handle(tv->window);
+ struct gemtk_wm_scroll_info_s *slid;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
struct redraw_context ctx = {
.interactive = true,
@@ -468,13 +468,13 @@ void atari_treeview_resized(struct tree *tree, int width, int
height, void *pw)
return;
tv->extent.x = width;
tv->extent.y = height;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &area);
slid->x_units = (width/slid->x_unit_px);
slid->y_units = (height/slid->y_unit_px);
/*printf("units content: %d, units viewport: %d\n",
(height/slid->y_unit_px),
(area.g_h/slid->y_unit_px));*/
- guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER);
}
}
@@ -498,10 +498,10 @@ static void atari_treeview_get_grect(NSTREEVIEW tv, enum
treeview_area_e mode,
{
if (mode == TREEVIEW_AREA_CONTENT) {
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, dest);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
}
else if (mode == TREEVIEW_AREA_TOOLBAR) {
- guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, dest);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, dest);
}
}
diff --git a/atari/treeview.h b/atari/treeview.h
index 19b7730..664b3a4 100755
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -36,13 +36,13 @@ struct atari_treeview
POINT extent;
POINT click;
POINT startdrag;
- guiwin_event_handler_f user_func;
+ gemtk_wm_event_handler_f user_func;
};
typedef struct atari_treeview * NSTREEVIEW;
NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func);
+ gemtk_wm_event_handler_f user_func);
void atari_treeview_destroy( NSTREEVIEW tv );
void atari_treeview_open( NSTREEVIEW tv );
void atari_treeview_close( NSTREEVIEW tv );
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/2e91d4e17eea2382814...
commit 2e91d4e17eea238281451532437e7447bfd4f0bf
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Do not redraw textarea background.
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index e31fc8e..679858a 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -248,5 +248,5 @@ char *get_text(OBJECT * tree, short idx);
GRECT * obj_screen_rect(OBJECT * tree, short obj);
bool obj_is_inside(OBJECT * tree, short obj, GRECT *area);
OBJECT *get_tree(int idx);
-void obj_mouse_sprite(OBJECT *tree, int index);
+void gemtk_obj_mouse_sprite(OBJECT *tree, int index);
#endif // GEMTK_H_INCLUDED
diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c
index 3221fda..0584438 100644
--- a/atari/gemtk/objc.c
+++ b/atari/gemtk/objc.c
@@ -125,7 +125,7 @@ GRECT * obj_screen_rect(OBJECT * tree, short obj)
}
-void obj_mouse_sprite(OBJECT *tree, int index)
+void gemtk_obj_mouse_sprite(OBJECT *tree, int index)
{
MFORM mform;
int dum;
diff --git a/atari/misc.c b/atari/misc.c
index d339379..d5837d7 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -323,7 +323,7 @@ void gem_set_cursor( MFORM_EX * cursor )
if( flags == cursor->flags && number == cursor->number )
return;
if( cursor->flags & MFORM_EX_FLAG_USERFORM ) {
- obj_mouse_sprite(cursor->tree, cursor->number);
+ gemtk_obj_mouse_sprite(cursor->tree, cursor->number);
} else {
graf_mouse(cursor->number, NULL );
}
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index 3ccd22d..64a8e35 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 7fe6bc9..268aff5 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -56,7 +56,7 @@
#define TOOLBAR_BT_FORWARD 14 /* CICON in tree TOOLBAR */
#define TOOLBAR_BT_STOP 15 /* CICON in tree TOOLBAR */
#define TOOLBAR_BT_RELOAD 16 /* CICON in tree TOOLBAR */
-#define TOOLBAR_AREA_URL 17 /* BOX in tree TOOLBAR */
+#define TOOLBAR_AREA_URL 17 /* USERDEF in tree TOOLBAR */
#define TOOLBAR_THROBBER_AREA 18 /* BOX in tree TOOLBAR */
#define ICONIFY 2 /* form/dial */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 08f9828..189c600 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -3,7 +3,7 @@ ResourceMaster v3.65
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@639@
+#M 20010100@0@7728@640@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -59,7 +59,7 @@ ResourceMaster v3.65
#O 14@33@BT_FORWARD@@
#O 15@33@BT_STOP@@
#O 16@33@BT_RELOAD@@
-#O 17@20@AREA_URL@@
+#O 17@24@AREA_URL@@
#O 18@20@THROBBER_AREA@@
#T 2@2@ICONIFY@@3@@
#O 1@33@GLOBE@@
@@ -196,4 +196,4 @@ ResourceMaster v3.65
#T 15@2@POP_FONT_RENDERER@@3@@
#O 1@28@INTERNAL@@
#O 2@28@FREETYPE@@
-#c 22525@
+#c 22411@
diff --git a/atari/toolbar.c b/atari/toolbar.c
index a6b7930..6afb660 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -223,11 +223,22 @@ static struct s_tb_button *button_init(struct s_toolbar *tb, OBJECT
* tree, int
}
+static short __CDECL toolbar_url_userdraw(PARMBLK *parmblock)
+{
+ return(0);
+}
+
void toolbar_init( void )
{
+ static USERBLK userblk;
+
aes_toolbar = get_tree(TOOLBAR);
throbber_form = get_tree(THROBBER);
+ userblk.ub_code = toolbar_url_userdraw;
+ userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
+ aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk;
+
area_full_height = aes_toolbar->ob_height;
area_search_height = aes_toolbar[TOOLBAR_AREA_SEARCH].ob_height;
area_navigation_height = aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_height;
@@ -270,8 +281,8 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
}
t->btcnt = i;
t->buttons = malloc(t->btcnt * sizeof(struct s_tb_button));
- memset( t->buttons, 0, t->btcnt * sizeof(struct s_tb_button));
- for (i=0; i < t->btcnt; i++ ) {
+ memset(t->buttons, 0, t->btcnt * sizeof(struct s_tb_button));
+ for (i=0; i < t->btcnt; i++) {
button_init(t, aes_toolbar, i, &t->buttons[i]);
}
@@ -438,11 +449,11 @@ void toolbar_update_buttons(struct s_toolbar *tb, struct
browser_window *bw,
}
}
- if (button == TOOLBAR_BT_HOME || button <= 0 ){
+ if (button == TOOLBAR_BT_HOME || button <= 0 ) {
}
- if( button == TOOLBAR_BT_FORWARD || button <= 0 ){
+ if (button == TOOLBAR_BT_FORWARD || button <= 0 ) {
bt = find_button(tb, TOOLBAR_BT_FORWARD);
enable = browser_window_forward_available(bw);
if (enable) {
@@ -452,7 +463,7 @@ void toolbar_update_buttons(struct s_toolbar *tb, struct
browser_window *bw,
}
}
- if( button == TOOLBAR_BT_RELOAD || button <= 0 ){
+ if (button == TOOLBAR_BT_RELOAD || button <= 0 ) {
bt = find_button(tb, TOOLBAR_BT_RELOAD);
enable = browser_window_reload_available(bw);
if (enable) {
@@ -590,7 +601,7 @@ void toolbar_set_visible(struct s_toolbar *tb, short area, bool
visible)
void toolbar_set_reflow(struct s_toolbar *tb, bool do_reflow)
{
- tb->reflow = true;
+ tb->reflow = do_reflow;
}
void toolbar_set_attached(struct s_toolbar *tb, bool attached)
@@ -743,7 +754,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
} while (mb & 1);
- textarea_drag_end( tb->url.textarea, 0, mx, my );
+ textarea_drag_end( tb->url.textarea, 0, mx, my);
}
else {
/* when execution reaches here, mouse input is a click or dclick */
-----------------------------------------------------------------------
Summary of changes:
!NetSurf/!Boot,feb | 11 +-
!NetSurf/ChkSprites,ffb | Bin 0 -> 881 bytes
.gitignore | 1 -
Makefile.defaults | 4 +-
Makefile.sources | 18 -
amiga/Makefile.target | 7 +-
amiga/agclass/amigaguide_class.c | 346 +++++
amiga/agclass/amigaguide_class.h | 40 +
amiga/bitmap.c | 5 +-
amiga/clipboard.c | 44 +-
amiga/dist/Install | 18 +
amiga/dist/NetSurf.guide | 106 ++-
amiga/font.c | 6 +-
amiga/gui.c | 84 +-
amiga/gui.h | 2 -
amiga/gui_options.c | 30 +-
amiga/help.c | 66 +
amiga/{iff_cset.h => help.h} | 25 +-
amiga/plotters.c | 22 +-
amiga/search.c | 42 +-
amiga/theme.c | 6 +-
atari/Makefile.defaults | 4 +
atari/Makefile.target | 2 +
atari/ctxmenu.c | 4 +-
atari/deskmenu.c | 15 +-
atari/download.c | 38 +-
atari/encoding.c | 2 +
atari/gemtk/dragdrop.c | 52 +-
atari/gemtk/gemtk.h | 156 +-
atari/gemtk/guiwin.c | 357 +++--
atari/gemtk/msgbox.c | 30 +-
atari/gemtk/objc.c | 420 ++++--
atari/gemtk/utils.c | 4 +-
atari/gui.c | 289 ++--
atari/gui.h | 1 +
atari/history.c | 16 +-
atari/hotlist.c | 33 +-
atari/login.c | 2 +-
atari/misc.c | 8 +-
atari/plot/font_freetype.c | 7 +-
atari/plot/font_internal.c | 16 +-
atari/plot/font_vdi.c | 207 ++-
atari/plot/plot.c | 72 +-
atari/plot/plot.h | 4 +-
atari/res/netsurf.rsc | Bin 34570 -> 34578 bytes
atari/res/netsurf.rsh | 2 +-
atari/res/netsurf.rsm | 6 +-
atari/rootwin.c | 225 ++--
atari/rootwin.h | 2 +-
atari/search.c | 48 +-
atari/settings.c | 98 +-
atari/statusbar.c | 2 +-
atari/toolbar.c | 412 +++++-
atari/toolbar.h | 3 +-
atari/treeview.c | 57 +-
atari/treeview.h | 4 +-
beos/scaffolding.cpp | 6 +-
beos/window.cpp | 82 +-
desktop/mouse.h | 40 +-
desktop/textarea.c | 1069 +++++++++----
desktop/textarea.h | 109 +-
desktop/tree.c | 114 +-
gtk/treeview.c | 2 +-
image/png.c | 3 +-
javascript/jsapi.h | 28 +-
javascript/jsapi/htmldocument.bnd | 50 +-
javascript/jsapi/htmlelement.bnd | 178 +++
javascript/jsapi/nodelist.bnd | 41 +-
render/textinput.c | 8 +-
riscos/distribution/!System/310/Modules/Iconv,ffa | Bin 57476 -> 66240 bytes
riscos/distribution/3rdParty/Iconv/ReadMe | 2 +-
riscos/distribution/3rdParty/Iconv/doc/ChangeLog | 7 +
riscos/filetype.c | 14 +-
riscos/font.c | 25 +-
riscos/gui.c | 39 +-
riscos/save.c | 5 +
riscos/scripts/Run | 11 +-
riscos/textselection.c | 232 +++-
riscos/textselection.h | 8 +
riscos/window.c | 11 +-
test/js/dom-getElementsByTagName.html | 10 +
utils/corestrings.c | 3 +
utils/corestrings.h | 1 +
utils/nsurl.c | 3 +
utils/transtab | 1688 ---------------------
utils/tt2code | 60 -
utils/useragent.c | 10 +-
utils/utils.h | 1 -
88 files changed, 3907 insertions(+), 3434 deletions(-)
create mode 100644 !NetSurf/ChkSprites,ffb
create mode 100755 amiga/agclass/amigaguide_class.c
create mode 100755 amiga/agclass/amigaguide_class.h
create mode 100755 amiga/help.c
copy amiga/{iff_cset.h => help.h} (64%)
delete mode 100644 utils/transtab
delete mode 100755 utils/tt2code
diff --git a/!NetSurf/!Boot,feb b/!NetSurf/!Boot,feb
index b1d9edc..1ba2ebd 100644
--- a/!NetSurf/!Boot,feb
+++ b/!NetSurf/!Boot,feb
@@ -43,14 +43,9 @@ If (("<NetSurf$Publisher>" = "") OR
("<NetSurf$ForceVars>" = "1")) Then Set NetS
If (("<NetSurf$Description>" = "") OR
("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Description
"Web browser"
| NetSurf Sprites
-|
-| The sprite file used is based on the OS and SpriteExtend versions:
-| RO <> 5 and SpriteExtend < 1.50 uses !Sprites<nn>
-| RO <> 5 and SpriteExtend >= 1.50 uses ASprites<nn>
-| RO = 5 uses 5Sprites<nn>
-Set NetSurf$Sprites <NetSurf$Dir>.ASprites
-RMEnsure SpriteExtend 1.50 Set NetSurf$Sprites <NetSurf$Dir>.!Sprites
-If (("<Boot$OSVersion>" >= "500") AND
("<Boot$OSVersion>" < "600")) Then IconSprites
<NetSurf$Dir>.5Sprites Else IconSprites <NetSurf$Sprites>
+Set NetSurf$Sprites "!Sprites"
+/<NetSurf$Dir>.ChkSprites
+IconSprites <NetSurf$Dir>.<NetSurf$Sprites>
Unset NetSurf$Sprites
| Acorn URI protocol
diff --git a/!NetSurf/ChkSprites,ffb b/!NetSurf/ChkSprites,ffb
new file mode 100644
index 0000000..52e456c
Binary files /dev/null and b/!NetSurf/ChkSprites,ffb differ
diff --git a/.gitignore b/.gitignore
index 4002e54..84eca23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,6 @@ windows/res/preferences
test/nsurl
test/urldbtest
test/llcache
-utils/translit.c
utils/testament.h
codedocs
nsgtk
diff --git a/Makefile.defaults b/Makefile.defaults
index 7650b38..d8f5b9b 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -78,9 +78,9 @@ NETSURF_USE_HARU_PDF := NO
NETSURF_STRIP_BINARY := NO
# Template used for constructing the User Agent: string. The first two
-# replacements are major/minor version, second two are OS and architecture.
+# replacements are major/minor version, next is OS.
# Please don't be tempted to mention Mozilla here! Let's let that lie die.
-NETSURF_UA_FORMAT_STRING := "NetSurf/%d.%d (%s; %s)"
+NETSURF_UA_FORMAT_STRING := "NetSurf/%d.%d (%s)"
# Default home page, if one is not defined by the user. Note that this
# option does not apply to the RISC OS version, as it has its own local
diff --git a/Makefile.sources b/Makefile.sources
index 32db5e6..a38290d 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -74,21 +74,3 @@ S_BROWSER := $(addprefix desktop/,$(S_BROWSER))
content/fetchers/about.c: testament utils/testament.h
desktop/version.c: testament utils/testament.h
-# Some extra rules for building the transliteration table.
-ifeq ($(HOST),riscos)
-utils/translit.c: transtab
- $(VQ)echo "TRANSTAB: utils/translit.c"
- $(Q)dir utils
- $(Q)$(PERL) tt2code < transtab > translit.c
- $(Q)dir ^
-else
-utils/translit.c: transtab
- $(VQ)echo "TRANSTAB: utils/translit.c"
- $(Q)cd utils; $(PERL) tt2code < transtab > translit.c
-endif
-
-clean-intermediates:
- $(VQ)echo " CLEAN: intermediates"
- $(Q)$(RM) utils/translit.c
-
-CLEANS += clean-intermediates
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index f2c4299..dc79479 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -59,7 +59,7 @@ else
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
ifeq ($(SUBTARGET),os3)
- LDFLAGS += -liconv
+ LDFLAGS += -lpbl -liconv
else
LDFLAGS += -lauto -lpbl -liconv
endif
@@ -75,11 +75,12 @@ EXETARGET := NetSurf
S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
- cookies.c context_menu.c clipboard.c \
+ cookies.c context_menu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
- stringview/stringview.c stringview/urlhistory.c font_scan.c
+ stringview/stringview.c stringview/urlhistory.c \
+ agclass/amigaguide_class.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
# This is the final source build list
diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c
new file mode 100755
index 0000000..dfac7ad
--- /dev/null
+++ b/amiga/agclass/amigaguide_class.c
@@ -0,0 +1,346 @@
+/*
+ * AmigaGuide Class
+ * A BOOPSI class for displaying AmigaGuide files.
+ * by Daniel "Trixie" Jedlicka
+ */
+
+#undef __USE_INLINE__
+
+#include "amigaguide_class.h"
+
+struct localObjectData
+{
+ struct NewAmigaGuide nag;
+ struct AmigaGuideMsg *agm;
+ AMIGAGUIDECONTEXT agHandle;
+ uint32 agContextID;
+ uint32 agSignal;
+ BOOL agActive;
+};
+
+struct Library *AmigaGuideBase = NULL;
+struct AmigaGuideIFace *IAmigaGuide = NULL;
+
+
+/* ********************************** function prototypes
************************************ */
+
+static uint32 dispatchAGClass(Class *, Object *, Msg);
+BOOL freeAGClass(Class *);
+
+// class methods
+uint32 om_new(Class *, Object *, struct opSet *);
+uint32 om_dispose(Class *, Object *, Msg);
+uint32 om_set(Class *, Object *, struct opSet *);
+uint32 om_get(Class *, Object *, struct opGet *);
+uint32 agm_open(Class *, Object *, Msg);
+uint32 agm_close(Class *, Object *, Msg);
+
+
+/* *************************** class initialization and disposal
***************************** */
+
+
+Class *initAGClass(void)
+{
+ Class *cl = NULL;
+
+
+ // Open amigaguide.library and its interface.
+ if ( (AmigaGuideBase = IExec->OpenLibrary("amigaguide.library", 52)) )
+ {
+ if ( (IAmigaGuide = (struct AmigaGuideIFace *)IExec->GetInterface(AmigaGuideBase,
"main", 1L, NULL)) )
+ {
+ if ( (cl = IIntuition->MakeClass(NULL, "rootclass", NULL, sizeof(struct
localObjectData), 0)) )
+ {
+ cl->cl_Dispatcher.h_Entry = (HOOKFUNC)dispatchAGClass;
+ IIntuition->AddClass(cl);
+ }
+ else freeAGClass(NULL);
+ }
+ else freeAGClass(NULL);
+ }
+
+ return cl;
+
+}
+
+
+
+BOOL freeAGClass(Class *cl)
+{
+ BOOL retVal = FALSE;
+
+
+ // Close amigaguide.library and free the class.
+ if (IAmigaGuide) IExec->DropInterface((struct Interface *)IAmigaGuide);
+ if (AmigaGuideBase) IExec->CloseLibrary(AmigaGuideBase);
+ if (cl) retVal = IIntuition->FreeClass(cl);
+
+ return retVal;
+}
+
+
+
+/* ************************************** class dispatcher
************************************ */
+
+
+static uint32 dispatchAGClass(Class *cl, Object *o, Msg msg)
+{
+
+ switch (msg->MethodID)
+ {
+ case OM_NEW:
+ return om_new(cl, o, (struct opSet *)msg);
+
+ case OM_DISPOSE:
+ return om_dispose(cl, o, msg);
+
+ case OM_UPDATE:
+ case OM_SET:
+ return om_set(cl, o, (struct opSet *)msg);
+
+ case OM_GET:
+ return om_get(cl, o, (struct opGet *)msg);
+
+ case AGM_OPEN:
+ return agm_open(cl, o, msg);
+
+ case AGM_CLOSE:
+ return agm_close(cl, o, msg);
+
+ default:
+ return IIntuition->IDoSuperMethodA(cl, o, msg);
+ }
+
+}
+
+
+/* *************************************** class methods
************************************** */
+
+uint32 om_new(Class *cl, Object *o, struct opSet *msg)
+{
+ struct localObjectData *lod = NULL;
+ uint32 retVal = 0L;
+
+
+ if ( (retVal = IIntuition->IDoSuperMethodA(cl, o, (Msg)msg)) )
+ {
+ // Obtain pointer to our object's local instance data.
+ if ( (lod = (struct localObjectData *)INST_DATA(cl, retVal)) )
+ {
+ // Initialize values.
+ lod->agActive = FALSE;
+ lod->agHandle = NULL;
+ lod->agContextID = 0;
+ lod->nag.nag_Name = NULL;
+ lod->nag.nag_Screen = NULL;
+ lod->nag.nag_PubScreen = NULL;
+ lod->nag.nag_BaseName = NULL;
+ lod->nag.nag_Context = NULL;
+ lod->nag.nag_Client = NULL; // private, must be NULL!
+
+ // Set initial object attributes based on the tags from NewObject().
+ om_set(cl, (Object *)retVal, msg);
+ }
+ }
+
+ return retVal;
+
+}
+
+
+
+
+
+uint32 om_dispose(Class *cl, Object *o, Msg msg)
+{
+
+ // Close the document, should it still be opened.
+ agm_close(cl, o, msg);
+
+ // Let superclass dispose of the object.
+ return IIntuition->IDoSuperMethodA(cl, o, msg);
+
+}
+
+
+
+
+
+uint32 om_set(Class *cl, Object *o, struct opSet *msg)
+{
+ struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
+ struct TagItem *tags, *ti;
+
+
+ tags = msg->ops_AttrList;
+
+ while ((ti = IUtility->NextTagItem (&tags)))
+ {
+ switch (ti->ti_Tag)
+ {
+ case AMIGAGUIDE_Name:
+ lod->nag.nag_Name = (STRPTR)ti->ti_Data;
+ lod->agActive = FALSE; // Database name has changed, we must setup the help
system again.
+ break;
+
+ case AMIGAGUIDE_Screen:
+ lod->nag.nag_Screen = (struct Screen *)ti->ti_Data;
+ lod->agActive = FALSE; // Screen pointer has changed, we must setup the help
system again.
+ break;
+
+ case AMIGAGUIDE_PubScreen:
+ lod->nag.nag_PubScreen = (STRPTR)ti->ti_Data;
+ lod->agActive = FALSE; // Pubscreen name has changed, we must setup the help
system again.
+ break;
+
+ case AMIGAGUIDE_BaseName:
+ lod->nag.nag_BaseName = (STRPTR)ti->ti_Data;
+ lod->agActive = FALSE; // Application basename has changed, we must setup the
help system again.
+ break;
+
+ case AMIGAGUIDE_ContextArray:
+ lod->nag.nag_Context = (STRPTR *)ti->ti_Data;
+ lod->agActive = FALSE; // Context array has changed, we must setup the help
system again.
+ break;
+
+ case AMIGAGUIDE_ContextID:
+ lod->agContextID = (uint32)ti->ti_Data;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+ // Setup the help system, if not ready yet or needs changing.
+ if ( lod->agActive == FALSE )
+ {
+ // Shut down help system should it already be running.
+ if ( lod->agHandle ) agm_close(cl, o, (Msg)msg);
+
+ // (Re)establish the AmigaGuide context and open the database asynchronously.
+ if ( (lod->agHandle = IAmigaGuide->OpenAmigaGuideAsync(&(lod->nag),
NULL)) )
+ {
+ if ( (lod->agSignal = IAmigaGuide->AmigaGuideSignal(lod->agHandle)) )
+ {
+ // Wait until the help system is up and running.
+ IExec->Wait(lod->agSignal);
+ while ( !(lod->agActive) )
+ {
+ while ( (lod->agm = IAmigaGuide->GetAmigaGuideMsg(lod->agHandle)) )
+ {
+ // The AmigaGuide process started OK.
+ if ( lod->agm->agm_Type == ActiveToolID ) lod->agActive = TRUE;
+
+ // Opening the guide file failed for some reason, continue as usual.
+ if ( lod->agm->agm_Type == ToolStatusID &&
lod->agm->agm_Pri_Ret ) lod->agActive = TRUE;
+
+ IAmigaGuide->ReplyAmigaGuideMsg(lod->agm);
+ }
+ }
+ }
+ }
+ }
+
+ return (uint32)lod->agHandle;
+
+}
+
+
+
+
+
+uint32 om_get(Class *cl, Object *o, struct opGet *msg)
+{
+ struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
+ uint32 retVal = 0L;
+
+
+ switch (msg->opg_AttrID)
+ {
+ case AMIGAGUIDE_Name:
+ *(msg->opg_Storage) = (uint32)lod->nag.nag_Name;
+ retVal = 1;
+ break;
+
+ case AMIGAGUIDE_Screen:
+ *(msg->opg_Storage) = (uint32)lod->nag.nag_Screen;
+ retVal = 1;
+ break;
+
+ case AMIGAGUIDE_PubScreen:
+ *(msg->opg_Storage) = (uint32)lod->nag.nag_PubScreen;
+ retVal = 1;
+ break;
+
+ case AMIGAGUIDE_BaseName:
+ *(msg->opg_Storage) = (uint32)lod->nag.nag_BaseName;
+ retVal = 1;
+ break;
+
+ case AMIGAGUIDE_ContextArray:
+ *(msg->opg_Storage) = (uint32)lod->nag.nag_Context;
+ retVal = 1;
+ break;
+
+ case AMIGAGUIDE_ContextID:
+ *(msg->opg_Storage) = (uint32)lod->agContextID;
+ retVal = 1;
+ break;
+
+ default:
+ retVal = IIntuition->IDoSuperMethodA(cl, o, (Msg)msg);
+ }
+
+ return retVal;
+
+}
+
+
+
+
+
+uint32 agm_open(Class *cl, Object *o, Msg msg)
+{
+ struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
+ uint32 retVal = 0;
+
+
+ if ( (lod->agHandle) && (lod->agActive) )
+ {
+ if ( lod->nag.nag_Context )
+ {
+ // A context node array is provided = open the current context node.
+ IAmigaGuide->SetAmigaGuideContext(lod->agHandle, lod->agContextID, NULL);
+ retVal = IAmigaGuide->SendAmigaGuideContext(lod->agHandle, NULL);
+ }
+ else
+ {
+ // No context array is provided = open the main node.
+ retVal = IAmigaGuide->SendAmigaGuideCmd(lod->agHandle, "LINK MAIN",
TAG_DONE);
+ }
+ }
+
+ return retVal;
+}
+
+
+
+
+
+uint32 agm_close(Class *cl, Object *o, Msg msg)
+{
+ struct localObjectData *lod = (struct localObjectData *)INST_DATA(cl, o);
+
+
+ if ( lod->agHandle )
+ {
+ IAmigaGuide->CloseAmigaGuide(lod->agHandle);
+ lod->agHandle = NULL;
+ lod->agActive = FALSE;
+ }
+
+ return (uint32)lod->agHandle;
+
+}
diff --git a/amiga/agclass/amigaguide_class.h b/amiga/agclass/amigaguide_class.h
new file mode 100755
index 0000000..f122f35
--- /dev/null
+++ b/amiga/agclass/amigaguide_class.h
@@ -0,0 +1,40 @@
+/*
+ * AmigaGuide Class
+ *
+ */
+
+#ifndef AMIGAGUIDE_CLASS_H
+#define AMIGAGUIDE_CLASS_H
+
+#include <exec/types.h>
+#include <intuition/classes.h>
+
+#include <classes/window.h>
+
+#include <proto/exec.h>
+#include <proto/intuition.h>
+#include <proto/amigaguide.h>
+#include <proto/utility.h>
+
+
+
+// tag definitions
+#define AMIGAGUIDE_Dummy (TAG_USER+0x05000000)
+
+#define AMIGAGUIDE_Name (AMIGAGUIDE_Dummy + 1) // Name of the AmigaGuide
database.
+#define AMIGAGUIDE_Screen (AMIGAGUIDE_Dummy + 2) // Pointer of the screen to open
on.
+#define AMIGAGUIDE_PubScreen (AMIGAGUIDE_Dummy + 3) // Name of the public screen to
open on.
+#define AMIGAGUIDE_BaseName (AMIGAGUIDE_Dummy + 4) // Basename of the application
that opens the help file.
+#define AMIGAGUIDE_ContextArray (AMIGAGUIDE_Dummy + 5) // Context node array (must be
NULL-terminated).
+#define AMIGAGUIDE_ContextID (AMIGAGUIDE_Dummy + 6) // Index value of the node to
display.
+
+// method definition
+#define AGM_OPEN WM_OPEN
+#define AGM_CLOSE WM_CLOSE
+
+// function prototypes
+Class *initAGClass(void);
+BOOL freeAGClass(Class *);
+
+#endif // AMIGAGUIDE_CLASS_H
+
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 3a2bc70..2fa8eb7 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -402,6 +402,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap
*bitmap,int width,
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function
isn't in OS4.0, so checking for v53 (OS4.1)
{
+#ifdef __amigaos4__
uint32 comptype = COMPOSITE_Src;
uint32 flags = 0;
@@ -420,9 +421,9 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap
*bitmap,int width,
COMPTAG_OffsetY,0,
COMPTAG_FriendBitMap,friendbm,
TAG_DONE);
+#endif
}
- else /* do it the old-fashioned way. This is pretty slow, but probably
- uses Composite() on OS4.1 anyway, so we're only saving a blit really. */
+ else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */
{
bsa.bsa_SrcX = 0;
bsa.bsa_SrcY = 0;
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 5e51efc..3897851 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -122,7 +122,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size
{
struct CollectionItem *ci_new = NULL, *ci_next, *ci_curr = ci;
size_t len = 0;
- char *text = NULL, *p, *clip;
+ char *text = NULL, *p;
/* Scan the collected chunks to find out the total size.
* If they are not in UTF-8, convert the chunks first and create a new CollectionItem
list.
@@ -142,7 +142,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size
ci_next = ci_new;
}
- utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size,
&ci_next->ci_Data);
+ utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, (char
**)&ci_next->ci_Data);
ci_next->ci_Size = strlen(ci_next->ci_Data);
len += ci_next->ci_Size;
break;
@@ -159,7 +159,7 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size
utf8_from_enc(ci_curr->ci_Data,
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
codeset, DFCS_MIMENAME),
- ci_curr->ci_Size, &clip);
+ ci_curr->ci_Size, (char **)&ci_next->ci_Data);
ci_next->ci_Size = strlen(ci_next->ci_Data);
len += ci_next->ci_Size;
break;
@@ -175,9 +175,9 @@ char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG
codeset, size
p = text + len;
if(ci_new) {
- ci_curr = ci;
- } else {
ci_curr = ci_new;
+ } else {
+ ci_curr = ci;
}
do {
@@ -199,43 +199,27 @@ void gui_get_clipboard(char **buffer, size_t *length)
{
struct ContextNode *cn;
struct CollectionItem *ci = NULL;
+ struct StoredProperty *sp = NULL;
ULONG rlen=0,error;
- struct CSet cset;
+ struct CSet *cset;
LONG codeset = 0;
- cset.CodeSet = 0;
-
if(OpenIFF(iffh,IFFF_READ)) return;
if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return;
- if(StopChunk(iffh,ID_FTXT,ID_CSET)) return;
+ if(PropChunk(iffh,ID_FTXT,ID_CSET)) return;
if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return;
+ if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return;
- while(1)
- {
- error = ParseIFF(iffh,IFFPARSE_SCAN);
- if(error == IFFERR_EOC) continue;
- else if(error) break;
-
- cn = CurrentChunk(iffh);
-
- if((cn)&&(cn->cn_Type == ID_FTXT)&&(cn->cn_ID == ID_CSET))
- {
- /* Ideally when we stop here, we need to convert all CHRS chunks up to this
- * point based on the previous codeset. However, for simplicity, we just
- * assume only one CSET chunk is present and only take note of the last
- * CSET chunk if there is more than one.
- */
-
- rlen = ReadChunkBytes(iffh, &cset, 32);
- if(cset.CodeSet == 1) codeset = 106;
- else codeset = cset.CodeSet;
- }
- }
+ error = ParseIFF(iffh,IFFPARSE_SCAN);
if(ci = FindCollection(iffh, ID_FTXT, ID_UTF8)) {
*buffer = ami_clipboard_cat_collection(ci, 106, length);
} else if(ci = FindCollection(iffh, ID_FTXT, ID_CHRS)) {
+ if(sp = FindProp(iffh, ID_FTXT, ID_CSET)) {
+ cset = (struct CSet *)sp->sp_Data;
+ codeset = cset->CodeSet;
+ }
*buffer = ami_clipboard_cat_collection(ci, codeset, length);
}
diff --git a/amiga/dist/Install b/amiga/dist/Install
index e320964..0191429 100755
--- a/amiga/dist/Install
+++ b/amiga/dist/Install
@@ -382,6 +382,10 @@
(set #user-options (tackon #user-dir "Choices"))
(set #options-exist (exists #user-options))
(set #searchengines-exist (exists (tackon @default-dest
"Resources/SearchEngines")))
+(set #user-hotlist (tackon #user-dir "Hotlist"))
+(set #hotlist-exist (exists #user-hotlist))
+(set #old-hotlist (tackon @default-dest "Resources/Hotlist"))
+(set #old-hotlist-exist (exists #old-hotlist))
(set #aiss-theme "")
(if (= #options-exist 0)
@@ -411,6 +415,20 @@
)
)
+(if (= #hotlist-exist 0)
+ (if (= #old-hotlist-exist 1)
+ (
+ (copyfiles
+ (prompt "Migrating NetSurf 2.x Hotlist")
+ (help @copyfiles-help)
+ (source #old-hotlist)
+ (dest #user-dir)
+ (optional "askuser" "force" "oknodelete")
+ )
+ )
+ )
+)
+
(complete 18)
(if (>= osver 53)
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index 8759b2b..e38f9f7 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -7,14 +7,18 @@
http://www.netsurf-browser.org
@{" Change Log " link ChangeLog/Main}
-
@{" Licence " link COPYING/Main}
+
+@{" GUI " link GUI}
+@{" Preferences GUI " link Prefs}
+
@{" Command line options " link CLI}
@{" Options file " link Options}
@{" Fonts " link Fonts}
@{" ARexx port " link ARexx}
@{" OpenURL/URL Prefs " link OpenURL}
@{" Hotlist menu " link Hotlist}
+@{" Hotlist toolbar " link HotlistToolbar}
@{" Local MIME types " link MIMETypes}
@{" Keyboard controls " link Keyboard}
@@ -23,6 +27,81 @@
http://www.netsurf-browser.org
@{" Credits " link Contact}
@endnode
+@node GUI "Main window"
+NetSurf's main GUI consists of a toolbar across the top, an (optional) tab bar, an
(optional) hotlist toolbar and the main browser area. It also encompasses a pull-down
@{"menu" link Menu}.
+
+The toolbar buttons are, from left to right:
+@{b}Back@{ub} Go back one page in history. Right-clicking gives a menu showing the last
ten pages visited.
+@{b}Forward@{ub} Go forward one page in history. Right-clicking gives a menu showing up
to ten pages available.
+@{b}Stop@{ub} Stop loading the page.
+@{b}Reload@{ub} Reload the current page. Shift-clicking will reload all elements on the
page.
+@{b}Home@{ub} Load the home page.
+
+The gadget to the right of the buttons is the URL bar to type web addresses into. On the
far right is the search bar. Typing into here will search for the text using your default
search provider (see preferences @{"Advanced tab" link Prefs-Advanced}.
+
+Below these is the (optional) @{"hotlist toolbar" link HotlistToolbar}.
+Below this is the (optional) tab bar. This usually only displays when more than one tab
is open, but can be set in @{"preferences" link Prefs-Tabs} to be always
present. At the far right is a button to open a new tab. On OS4.0 the current tab can be
closed using the button on the far left. On OS4.1 the close gadget for the tab is
embedded in the tab itself.
+
+The rest of the window is taken up with the @{"browser rendering area" link
Browser}. This is where the pages visited will be displayed.
+@endnode
+
+@node Browser
+@toc GUI
+This is the main browser rendering area.
+
+Drag and drop is supported throughout, so files can be dropped onto text fields, text on
pages can be highlighted and dragged to Workbench or text fields. Other elements can be
saved by dragging them to Workbench with Ctrl or Shift held down.
+
+Note that dragging to Workbench only works when NetSurf is running on the Workbench
screen.
+@endnode
+
+@node Menu "Menu"
+@toc GUI
+Project Browser Edit @{"Hotlist" link Hotlist} @{"ARexx" link arexx}
+
+@endnode
+
+@node Prefs "Preferences GUI"
+@{"General" link Prefs-General} @{"Display" link Prefs-Display}
@{"Connection" link Prefs-Connection} @{"Rendering" link
Prefs-Rendering} @{"Fonts" link Prefs-Fonts} @{"Cache" link
Prefs-Cache} @{"Tabs" link Prefs-Tabs} @{"Advanced" link
Prefs-Advanced} @{"Export" link Prefs-Export}
+@endnode
+
+@node Prefs-General "Prefs - General"
+@toc Prefs
+@endnode
+
+@node Prefs-Display "Prefs - Display"
+@toc Prefs
+@endnode
+
+@node Prefs-Connection "Prefs - Connection"
+@toc Prefs
+@endnode
+
+@node Prefs-Rendering "Prefs - Rendering"
+@toc Prefs
+@endnode
+
+@node Prefs-Fonts "Prefs - Fonts"
+@toc Prefs
+See @{"Fonts" link Fonts}
+@endnode
+
+@node Prefs-Cache "Prefs - Cache"
+@toc Prefs
+@endnode
+
+@node Prefs-Tabs "Prefs - Tabs"
+@toc Prefs
+@endnode
+
+@node Prefs-Advanced "Prefs - Advanced"
+@toc Prefs
+@endnode
+
+@node Prefs-Export "Prefs - Export"
+@toc Prefs
+This section contains options for exporting to PDF. It is not enabled in current builds
of NetSurf.
+@endnode
+
@node cli "Command line options"
NetSurf URL/K,FORCE/S
@@ -44,13 +123,10 @@ There are a couple of Amiga-specific options which can only be
changed directly
@{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the
pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running
on the Workbench screen) and text selection drags. If set to 0 the pointer style will
change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and
obscure the drop position.
@{b}cairo_renderer@{ub} Set rendering engine. -1 = palette-mapped (set automatically when
required), 0 = graphics.library (default), 1 = Cairo/graphics.library mixed, 2 = Full
Cairo.
@{b}monitor_aspect_x@{ub}/@{b}monitor_aspect_y@{ub} Correct aspect ratio for displays
(default of 0 means "assume square pixels").
-@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable,
1=enable, 2=default
+@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable,
1=enable, 2=default (NB: This is indirectly modified by changing the "simple
refresh" option in the GUI)
@{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the
off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables
tiling (will use a bitmap at least the size of the screen NetSurf is running on)
-@{b}font_antialiasing@{ub} Switch text anti-aliasing on or off. Defaults to on in
true-colour modes, but text rendering performance can be improved by setting to 0.
-@{b}window_simple_refresh@{ub} If set to 1, NetSurf will use SimpleRefresh rather than
SmartRefresh windows. These have slower redraw but use less memory. Note that this
setting has no noticeable effect if compositing is enabled. Defaults to 0 (SmartRefresh)
@{b}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web
search gadget next to the URL bar.
-@{b}dithering_quality@{ub} Specify the dithering quality from all values supported by
picture.datatype. Currently these are 0=None, 1=Normal, 2=High quality. Other values are
undefined. This is only used when NetSurf is running in palette-mapped mode.
@{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to
full transparency (0 - 255, where 255 will convert even opaque pixels to transparent).
Defaults to 50 (0x32). This is only used in palette-mapped modes where alpha blending is
not currently supported.
@{b}url_file@{ub} Path to URL database file
@@ -61,7 +137,7 @@ There are a couple of Amiga-specific options which can only be changed
directly
@endnode
@node Fonts
-The font to use for each font type can be defined in NetSurf's options. OS4 NetSurf
supports soft styles for bold and italic, however designed fonts look better and it is
highly recommend to set them as follows:
+The font to use for each font type can be defined in NetSurf's options. OS4 NetSurf
supports soft styles for bold and italic, however designed fonts look better and it is
highly recommended to set them as follows:
Within @{"TypeManager" system "SYS:System/TypeManager"} select a font
being used by NetSurf and click on Modify.
On the Files tab, Font family section, choose the @{b}bold@{ub}, @{i}italic@{ui} and
@{b}@{i}bold-italic@{ui}@{ub} version of the font.
@@ -194,7 +270,7 @@ Folders with no items in them will show up disabled in the menu. If
they are na
eg.
-- Menu
+- Hotlist Menu
|
+- Netsurf
| |
@@ -216,6 +292,20 @@ Will look something like the following within the menu:
@endnode
+@node HotlistToolbar "Hotlist toolbar"
+A toolbar for frequently-accessed sites can be added to the main window. To do show,
follow these steps:
+
+* Select Show Hotlist from the Hotlist menu
+The Hotlist window will be displayed.
+
+* Locate the "Hotlist toolbar" folder in the tree (NetSurf creates this when it
starts up)
+
+* Move or create entries in this folder. Any entries directly inside the Hotlist toolbar
folder will appear on the toolbar when the hotlist window is closed. If it is empty the
toolbar will disappear to save space.
+
+Note that sub-folders are not currently supported on the toolbar.
+
+@endnode
+
@node mimetypes "Local MIME Types"
NetSurf determines the MIME types of local files primarily by checking the icon of the
file. If the icon is not found it will check the default icon for the file type.
@@ -294,5 +384,5 @@ The default theme icon was adapted from the NetSurf logo by Marko K.
Sepp
All other code and files are the same for all platforms and credited in the files and/or
on the NetSurf website.
http://www.netsurf-browser.org
-The source code can be obtained from
http://www.netsurf-browser.org SVN or (in the event
the service is unavailable) chris(a)unsatisfactorysoftware.co.uk or any other of the NetSurf
developers.
+The source code can be obtained from
http://source.netsurf-browser.org or (in the event
the service is unavailable) chris(a)unsatisfactorysoftware.co.uk or any other of the NetSurf
developers.
@endnode
diff --git a/amiga/font.c b/amiga/font.c
index ffecf85..33f71a9 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -156,7 +156,7 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle,
for(i=0;i<len;i++)
{
- if (*utf16 < 0xD800 || 0xDFFF < *utf16)
+ if ((*utf16 < 0xD800) || (0xDFFF < *utf16))
utf16charlen = 1;
else
utf16charlen = 2;
@@ -263,7 +263,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
{
utf8len = utf8_char_byte_length(string+utf8clen);
- if (*utf16 < 0xD800 || 0xDFFF < *utf16)
+ if ((*utf16 < 0xD800) || (0xDFFF < *utf16))
utf16charlen = 1;
else
utf16charlen = 2;
@@ -722,7 +722,7 @@ ULONG ami_unicode_text(struct RastPort *rp, const char *string, ULONG
length,
while(*utf16 != 0)
{
- if (*utf16 < 0xD800 || 0xDFFF < *utf16)
+ if ((*utf16 < 0xD800) || (0xDFFF < *utf16))
utf16charlen = 1;
else
utf16charlen = 2;
diff --git a/amiga/gui.c b/amiga/gui.c
index 4341270..eb5af26 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -53,6 +53,7 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/gui_options.h"
+#include "amiga/help.h"
#include "amiga/history.h"
#include "amiga/history_local.h"
#include "amiga/hotlist.h"
@@ -385,6 +386,7 @@ void ami_open_resources(void)
TAG_DONE))) die(messages_get("NoMemory"));
ami_file_req_init();
+ //ami_help_init(NULL);
}
void ami_set_options(void)
@@ -475,15 +477,19 @@ void ami_set_options(void)
tree_set_icon_dir(strdup("ENV:Sys"));
-
nsoption_setnull_charp(arexx_dir, (char *)strdup("Rexx"));
-
nsoption_setnull_charp(arexx_startup, (char *)strdup("Startup.nsrx"));
-
nsoption_setnull_charp(arexx_shutdown, (char *)strdup("Shutdown.nsrx"));
if(!nsoption_int(window_width)) nsoption_set_int(window_width, 800);
if(!nsoption_int(window_height)) nsoption_set_int(window_height, 600);
+
+#ifndef __amigaos4__
+ nsoption_set_bool(download_notify, false);
+ nsoption_set_bool(context_menu, false);
+ nsoption_set_bool(font_antialiasing, false);
+ nsoption_set_bool(truecolour_mouse_pointers, false);
+#endif
}
void ami_amiupdate(void)
@@ -666,6 +672,8 @@ void ami_openscreen(void)
gui_system_colour_finalize();
gui_system_colour_init();
+
+ //ami_help_new_screen(scrn);
}
void ami_openscreenfirst(void)
@@ -1002,6 +1010,7 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie)
else nskey = KEY_TAB;
break;
case RAWKEY_F5:
+ case RAWKEY_HELP:
// don't translate
nskey = keycode;
break;
@@ -1823,6 +1832,10 @@ void ami_handle_msg(void)
if(browser_window_reload_available(gwin->bw))
browser_window_reload(gwin->bw,false);
break;
+
+ case RAWKEY_HELP: // help
+ //ami_help_open(AMI_HELP_GUI);
+ break;
}
}
}
@@ -2362,11 +2375,13 @@ void ami_quit_netsurf_delayed(void)
}
}
-void ami_gui_close_screen(struct Screen *scrn)
+void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen)
{
if(scrn == NULL) return;
if(CloseScreen(scrn)) return;
+ if(locked_screen == TRUE) return;
+ /* If this is our own screen, wait for visitor windows to close */
LOG(("Waiting for visitor windows to close..."));
do {
Delay(50);
@@ -2395,10 +2410,7 @@ void gui_quit(void)
FreeScreenDrawInfo(scrn, dri);
ami_close_fonts();
-
- /* If it is our public screen, close it or wait until the visitor windows leave */
- if(locked_screen == FALSE) ami_gui_close_screen(scrn);
-
+ ami_gui_close_screen(scrn, locked_screen);
FreeVec(nsscreentitle);
ami_context_menu_free();
@@ -2410,6 +2422,7 @@ void gui_quit(void)
FreeSysObject(ASOT_PORT,appport);
FreeSysObject(ASOT_PORT,sport);
+ //ami_help_free();
ami_file_req_free();
ami_openurl_close();
@@ -3591,7 +3604,7 @@ void gui_window_set_title(struct gui_window *g, const char *title)
}
}
-void ami_do_redraw_tiled(struct gui_window_2 *gwin,
+void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
int left, int top, int width, int height,
int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
{
@@ -3630,24 +3643,22 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
if(width <= 0) return;
if(height <= 0) return;
-// printf("%ld %ld %ld %ld\n",left, top, width, height);
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
+ if(busy) ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
for(y = top; y < (top + height); y += tile_y_scale) {
clip.y0 = 0;
clip.y1 = nsoption_int(redraw_tile_size_y);
+ if(clip.y1 > height) clip.y1 = height;
if((((y - sy) * gwin->bw->scale) + clip.y1) > bbox->Height)
clip.y1 = bbox->Height - ((y - sy) * gwin->bw->scale);
for(x = left; x < (left + width); x += tile_x_scale) {
clip.x0 = 0;
clip.x1 = nsoption_int(redraw_tile_size_x);
+ if(clip.x1 > width) clip.x1 = width;
if((((x - sx) * gwin->bw->scale) + clip.x1) > bbox->Width)
clip.x1 = bbox->Width - ((x - sx) * gwin->bw->scale);
-//printf("%ld %ld -> %ld %ld\n",clip.x0 - (int)(x), clip.y0 - (int)(y),
clip.x1, clip.y1);
-
if(browser_window_redraw(gwin->bw,
clip.x0 - (int)x,
clip.y0 - (int)y,
@@ -3670,7 +3681,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
}
}
- ami_reset_pointer(gwin);
+ if(busy) ami_reset_pointer(gwin);
}
@@ -3685,7 +3696,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
* \param y1 bottom-right co-ordinate (in document co-ordinates)
*/
-void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
+void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw, bool busy,
int x0, int y0, int x1, int y1)
{
ULONG xoffset,yoffset,width=800,height=600;
@@ -3716,7 +3727,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct
browser_window *bw,
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
- ami_do_redraw_tiled(g->shared, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox, &ctx);
+ ami_do_redraw_tiled(g->shared, busy, x0, y0, x1 - x0, y1 - y0, sx, sy, bbox,
&ctx);
return;
}
@@ -3737,7 +3748,7 @@ void gui_window_update_box(struct gui_window *g, const struct rect
*rect)
{
if(!g) return;
- ami_do_redraw_limits(g, g->shared->bw,
+ ami_do_redraw_limits(g, g->shared->bw, true,
rect->x0, rect->y0,
rect->x1, rect->y1);
}
@@ -3796,14 +3807,14 @@ void ami_do_redraw(struct gui_window_2 *gwin)
if(vcurrent>oldv) /* Going down */
{
- ami_do_redraw_limits(gwin->bw->window, gwin->bw,
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, true,
hcurrent, (height / gwin->bw->scale) + oldv - 1,
hcurrent + (width / gwin->bw->scale),
vcurrent + (height / gwin->bw->scale) + 1);
}
else if(vcurrent<oldv) /* Going up */
{
- ami_do_redraw_limits(gwin->bw->window, gwin->bw,
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, true,
hcurrent, vcurrent,
hcurrent + (width / gwin->bw->scale),
oldv);
@@ -3811,14 +3822,14 @@ void ami_do_redraw(struct gui_window_2 *gwin)
if(hcurrent>oldh) /* Going right */
{
- ami_do_redraw_limits(gwin->bw->window, gwin->bw,
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, true,
(width / gwin->bw->scale) + oldh , vcurrent,
hcurrent + (width / gwin->bw->scale),
vcurrent + (height / gwin->bw->scale));
}
else if(hcurrent<oldh) /* Going left */
{
- ami_do_redraw_limits(gwin->bw->window, gwin->bw,
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, true,
hcurrent, vcurrent,
oldh, vcurrent + (height / gwin->bw->scale));
}
@@ -3836,7 +3847,7 @@ void ami_do_redraw(struct gui_window_2 *gwin)
if(nsoption_bool(direct_render) == false)
{
- ami_do_redraw_tiled(gwin, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox,
&ctx);
+ ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent,
bbox, &ctx);
}
else
{
@@ -3882,39 +3893,42 @@ void ami_refresh_window(struct gui_window_2 *gwin)
sy = gwin->bw->window->scrolly;
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox);
-
+ ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
+
BeginRefresh(gwin->win);
x0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinX - bbox->Left)
/
- browser_window_get_scale(gwin->bw)) + sx;
+ browser_window_get_scale(gwin->bw)) + sx - 1;
x1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxX - bbox->Left)
/
- browser_window_get_scale(gwin->bw)) + sx;
+ browser_window_get_scale(gwin->bw)) + sx + 2;
y0 = ((gwin->win->RPort->Layer->DamageList->bounds.MinY - bbox->Top)
/
- browser_window_get_scale(gwin->bw)) + sy;
+ browser_window_get_scale(gwin->bw)) + sy - 1;
y1 = ((gwin->win->RPort->Layer->DamageList->bounds.MaxY - bbox->Top)
/
- browser_window_get_scale(gwin->bw)) + sy;
+ browser_window_get_scale(gwin->bw)) + sy + 2;
regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle;
- ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1);
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, false, x0, y0, x1, y1);
while(regrect)
{
x0 = ((regrect->bounds.MinX - bbox->Left) /
- browser_window_get_scale(gwin->bw)) + sx;
+ browser_window_get_scale(gwin->bw)) + sx - 1;
x1 = ((regrect->bounds.MaxX - bbox->Left) /
- browser_window_get_scale(gwin->bw)) + sx;
+ browser_window_get_scale(gwin->bw)) + sx + 2;
y0 = ((regrect->bounds.MinY - bbox->Top) /
- browser_window_get_scale(gwin->bw)) + sy;
+ browser_window_get_scale(gwin->bw)) + sy - 1;
y1 = ((regrect->bounds.MaxY - bbox->Top) /
- browser_window_get_scale(gwin->bw)) + sy;
+ browser_window_get_scale(gwin->bw)) + sy + 2;
regrect = regrect->Next;
- ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1);
+ ami_do_redraw_limits(gwin->bw->window, gwin->bw, false, x0, y0, x1, y1);
}
EndRefresh(gwin->win, TRUE);
+
+ ami_reset_pointer(gwin);
}
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
@@ -4332,7 +4346,7 @@ void gui_window_remove_caret(struct gui_window *g)
if((nsoption_bool(kiosk_mode) == false))
OffMenu(g->shared->win, AMI_MENU_PASTE);
- ami_do_redraw_limits(g, g->shared->bw, g->c_x, g->c_y,
+ ami_do_redraw_limits(g, g->shared->bw, false, g->c_x, g->c_y,
g->c_x + g->c_w + 1, g->c_y + g->c_h + 1);
g->c_h = 0;
diff --git a/amiga/gui.h b/amiga/gui.h
index ff46797..60ea7d9 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -147,8 +147,6 @@ void ami_get_msg(void);
void ami_close_all_tabs(struct gui_window_2 *gwin);
void ami_quit_netsurf(void);
void ami_do_redraw(struct gui_window_2 *g);
-void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw,
- int x0, int y0, int x1, int y1);
STRPTR ami_locale_langs(void);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index e54ad15..bfee479 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -33,10 +33,12 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/gui_options.h"
+#include "amiga/help.h"
+#include "amiga/theme.h"
+#include "amiga/utf8.h"
#include "utils/messages.h"
#include "desktop/browser_private.h"
#include "desktop/options.h"
-#include "amiga/utf8.h"
#include "desktop/searchweb.h"
#include <proto/window.h>
@@ -729,12 +731,14 @@ void ami_gui_opts_open(void)
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_MOUSE],
+#ifdef __amigaos4__
LAYOUT_AddChild, gow->objects[GID_OPTS_PTRTRUE] =
CheckBoxObject,
GA_ID, GID_OPTS_PTRTRUE,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_PTRTRUE],
GA_Selected, nsoption_bool(truecolour_mouse_pointers),
CheckBoxEnd,
+#endif
LAYOUT_AddChild, gow->objects[GID_OPTS_PTROS] = CheckBoxObject,
GA_ID, GID_OPTS_PTROS,
GA_RelVerify, TRUE,
@@ -1070,6 +1074,7 @@ void ami_gui_opts_open(void)
LABEL_Text, gadlab[GID_OPTS_FONT_MINSIZE],
LabelEnd,
LayoutEnd,
+#ifdef __amigaos4__
LAYOUT_AddChild,VGroupObject,
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
@@ -1081,6 +1086,7 @@ void ami_gui_opts_open(void)
GA_Selected, nsoption_bool(font_antialiasing),
CheckBoxEnd,
LayoutEnd,
+#endif
LayoutEnd,
CHILD_WeightedHeight, 0,
LayoutEnd, // page vgroup
@@ -1205,6 +1211,7 @@ void ami_gui_opts_open(void)
GA_Text, gadlab[GID_OPTS_OVERWRITE],
GA_Selected, nsoption_bool(ask_overwrite),
CheckBoxEnd,
+#ifdef __amigaos4__
LAYOUT_AddChild, gow->objects[GID_OPTS_NOTIFY] =
CheckBoxObject,
GA_ID, GID_OPTS_NOTIFY,
GA_RelVerify, TRUE,
@@ -1212,6 +1219,7 @@ void ami_gui_opts_open(void)
GA_Text, gadlab[GID_OPTS_NOTIFY],
GA_Selected, nsoption_bool(download_notify),
CheckBoxEnd,
+#endif
LayoutEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_DLDIR] = GetFileObject,
GA_ID, GID_OPTS_DLDIR,
@@ -1244,12 +1252,14 @@ void ami_gui_opts_open(void)
GA_Text, gadlab[GID_OPTS_CLOSE_NO_QUIT],
GA_Selected, nsoption_bool(close_no_quit),
CheckBoxEnd,
+#ifdef __amigaos4__
LAYOUT_AddChild, gow->objects[GID_OPTS_DOCKY] = CheckBoxObject,
GA_ID, GID_OPTS_DOCKY,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_DOCKY],
GA_Selected, !nsoption_bool(hide_docky_icon),
CheckBoxEnd,
+#endif
LayoutEnd, // behaviour
CHILD_WeightedHeight, 0,
@@ -1292,12 +1302,14 @@ void ami_gui_opts_open(void)
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_MISC],
LAYOUT_SpaceOuter, TRUE,
+#ifdef __amigaos4__
LAYOUT_AddChild, gow->objects[GID_OPTS_CONTEXTMENU] =
CheckBoxObject,
GA_ID, GID_OPTS_CONTEXTMENU,
GA_RelVerify, TRUE,
GA_Text, gadlab[GID_OPTS_CONTEXTMENU],
GA_Selected, nsoption_bool(context_menu),
CheckBoxEnd,
+#endif
LAYOUT_AddChild, gow->objects[GID_OPTS_FASTSCROLL] =
CheckBoxObject,
GA_ID, GID_OPTS_FASTSCROLL,
GA_RelVerify, TRUE,
@@ -1582,10 +1594,12 @@ void ami_gui_opts_use(bool save)
}
GetAttr(GA_Selected,gow->objects[GID_OPTS_WIN_SIMPLE],(ULONG *)&data);
- if (data) {
+ if ((data == TRUE) && (nsoption_bool(window_simple_refresh) == false)) {
nsoption_set_bool(window_simple_refresh, true);
- } else {
+ nsoption_set_int(screen_compositing, 0);
+ } else if ((data == FALSE) && (nsoption_bool(window_simple_refresh) == true)) {
nsoption_set_bool(window_simple_refresh, false);
+ nsoption_set_int(screen_compositing, -1);
}
GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_THEME],(ULONG *)&data);
@@ -1887,6 +1901,16 @@ BOOL ami_gui_opts_event(void)
return TRUE;
break;
+ case WMHI_GADGETHELP:
+ if((result & WMHI_GADGETMASK) == 0) {
+ /* Pointer not over our window */
+ ami_help_open(AMI_HELP_MAIN);
+ } else {
+ /* TODO: Make this sensitive to the tab the user is currently on */
+ ami_help_open(AMI_HELP_PREFS);
+ }
+ break;
+
case WMHI_GADGETUP:
switch(result & WMHI_GADGETMASK)
{
diff --git a/amiga/help.c b/amiga/help.c
new file mode 100755
index 0000000..214e59d
--- /dev/null
+++ b/amiga/help.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2013 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+#include "amiga/help.h"
+
+/* AmigaGuide class */
+#include "amiga/agclass/amigaguide_class.h"
+
+Class *AmigaGuideClass = NULL;
+Object *AmigaGuideObject = NULL;
+
+/* This array needs to match the enum in help.h */
+STRPTR context_nodes[] = {
+ "Main",
+ "GUI",
+ "Prefs",
+ NULL
+};
+
+void ami_help_init(struct Screen *screen)
+{
+ AmigaGuideClass = initAGClass();
+
+ AmigaGuideObject = NewObject(AmigaGuideClass, NULL,
+ AMIGAGUIDE_Name, "PROGDIR:NetSurf.guide",
+ AMIGAGUIDE_BaseName, "NetSurf",
+ AMIGAGUIDE_Screen, screen,
+ AMIGAGUIDE_ContextArray, context_nodes,
+ AMIGAGUIDE_ContextID, AMI_HELP_MAIN,
+ TAG_DONE);
+}
+
+void ami_help_open(ULONG node)
+{
+ SetAttrs(AmigaGuideObject, AMIGAGUIDE_ContextID, node, TAG_DONE);
+ IDoMethod(AmigaGuideObject, AGM_OPEN, NULL);
+}
+
+void ami_help_free(void)
+{
+ if (AmigaGuideObject) DisposeObject(AmigaGuideObject);
+ if (AmigaGuideClass) freeAGClass(AmigaGuideClass);
+
+ AmigaGuideObject = NULL;
+ AmigaGuideClass = NULL;
+}
+
+void ami_help_new_screen(struct Screen *screen)
+{
+ SetAttrs(AmigaGuideObject, AMIGAGUIDE_Screen, screen, TAG_DONE);
+}
diff --git a/amiga/iff_cset.h b/amiga/help.h
similarity index 64%
copy from amiga/iff_cset.h
copy to amiga/help.h
index 2b8af8f..4baa2a0 100755
--- a/amiga/iff_cset.h
+++ b/amiga/help.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2013 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -16,18 +16,21 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_IFF_CSET_H
-#define AMIGA_IFF_CSET_H
+#ifndef AMIGA_HELP_H
+#define AMIGA_HELP_H
#include <exec/types.h>
-/* This structure is for the IFF CSET chunk, registered by Martin Taillefer */
+/* This enum needs to match context_array in help.c */
+enum {
+ AMI_HELP_MAIN,
+ AMI_HELP_GUI,
+ AMI_HELP_PREFS,
+};
-struct CSet {
- LONG CodeSet; /* 0=ECMA Latin 1 (std Amiga charset) */
- /* CBM will define additional values */
- LONG Reserved[7];
- };
-
-#define ID_CSET MAKE_ID('C','S','E','T')
+struct Screen;
+void ami_help_init(struct Screen *screen);
+void ami_help_open(ULONG node);
+void ami_help_free(void);
+void ami_help_new_screen(struct Screen *screen);
#endif
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 7347f06..ace3c3b 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009, 2012 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008-09, 2012-13 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -101,6 +101,18 @@ const struct plotter_table amiplot = {
.option_knockout = true,
};
+colour ami_abgr_to_argb(colour c) {
+ colour argb = 0x00000000;
+
+ /* NB: We force the alpha byte to be 0xff, as it is not set by the core. */
+ argb = 0xff000000 |
+ ((c & 0x00ff0000) >> 16) |
+ (c & 0x0000ff00) |
+ ((c & 0x000000ff) << 16);
+
+ return argb;
+}
+
#ifdef NS_AMIGA_CAIRO
void ami_cairo_set_colour(cairo_t *cr,colour c)
{
@@ -285,7 +297,7 @@ static void ami_plot_setapen(ULONG colour)
{
if(palette_mapped == false) {
SetRPAttrs(glob->rp, RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, colour),
+ ami_abgr_to_argb(colour),
TAG_DONE);
} else {
ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);
@@ -297,7 +309,7 @@ static void ami_plot_setopen(ULONG colour)
{
if(palette_mapped == false) {
SetRPAttrs(glob->rp, RPTAG_OPenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, colour),
+ ami_abgr_to_argb(colour),
TAG_DONE);
} else {
ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);
@@ -695,6 +707,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct
bitmap *bitma
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
+#ifdef __amigaos4__
uint32 comptype = COMPOSITE_Src;
if(!bitmap->opaque)
comptype = COMPOSITE_Src_Over_Dest;
@@ -710,6 +723,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct
bitmap *bitma
COMPTAG_OffsetX,x,
COMPTAG_OffsetY,y,
TAG_DONE);
+#endif
}
else
{
@@ -859,6 +873,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort
*rp,struct Ba
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
+#ifdef __amigaos4__
CompositeTags(COMPOSITE_Src_Over_Dest,bfbm->bm, rp->BitMap,
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
COMPTAG_DestX,bfmsg->Bounds.MinX,
@@ -870,6 +885,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort
*rp,struct Ba
COMPTAG_OffsetX,xf,
COMPTAG_OffsetY,yf,
TAG_DONE);
+#endif
}
else
{
diff --git a/amiga/search.c b/amiga/search.c
index 1148f6d..f1fad60 100755
--- a/amiga/search.c
+++ b/amiga/search.c
@@ -174,6 +174,9 @@ void ami_search_open(struct gui_window *gwin)
fwin->node = AddObject(window_list,AMINS_FINDWINDOW);
fwin->node->objstruct = fwin;
gwin->shared->searchwin = fwin;
+
+ ActivateLayoutGadget((struct Gadget *)fwin->objects[GID_MAIN], fwin->win,
+ NULL, fwin->objects[GID_SEARCHSTRING]);
}
void ami_search_close(void)
@@ -202,6 +205,26 @@ BOOL ami_search_event(void)
case WMHI_GADGETUP:
switch(result & WMHI_GADGETMASK)
{
+ case GID_SEARCHSTRING:
+ browser_window_search_destroy_context(
+ fwin->gwin->shared->bw);
+ ami_search_set_forward_state(
+ true, NULL);
+ ami_search_set_back_state(
+ true, NULL);
+
+ RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
+ fwin->win, NULL,
+ GA_Disabled, FALSE,
+ TAG_DONE);
+
+ RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
+ fwin->win, NULL,
+ GA_Disabled, FALSE,
+ TAG_DONE);
+
+ /* fall through */
+
case GID_NEXT:
search_insert = true;
flags = SEARCH_FLAG_FORWARDS |
@@ -228,25 +251,6 @@ BOOL ami_search_event(void)
flags,
ami_search_string());
ActivateWindow(fwin->gwin->shared->win);
- break;
-
- case GID_SEARCHSTRING:
- browser_window_search_destroy_context(
- fwin->gwin->shared->bw);
- ami_search_set_forward_state(
- true, NULL);
- ami_search_set_back_state(
- true, NULL);
-
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV],
- fwin->win, NULL,
- GA_Disabled, FALSE,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT],
- fwin->win, NULL,
- GA_Disabled, FALSE,
- TAG_DONE);
break;
}
break;
diff --git a/amiga/theme.c b/amiga/theme.c
index 65d2f51..fa058e0 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -265,6 +265,7 @@ void ami_init_mouse_pointers(void)
mouseptrobj[i] = NULL;
char ptrfname[1024];
+#ifdef __amigaos4__
if(nsoption_bool(truecolour_mouse_pointers))
{
ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false);
@@ -316,6 +317,7 @@ void ami_init_mouse_pointers(void)
}
}
}
+#endif
if(!mouseptrobj[i])
{
@@ -370,8 +372,8 @@ void ami_mouse_pointers_free(void)
{
if(mouseptrbm[i])
{
- FreeRaster(mouseptrbm[i]->Planes[0],16,16);
- FreeRaster(mouseptrbm[i]->Planes[1],16,16);
+ FreeRaster(mouseptrbm[i]->Planes[0],32,32);
+ FreeRaster(mouseptrbm[i]->Planes[1],32,32);
FreeVec(mouseptrbm[i]);
}
}
diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults
index a8b1857..83464d6 100644
--- a/atari/Makefile.defaults
+++ b/atari/Makefile.defaults
@@ -32,6 +32,10 @@
# Valid options: YES, NO
NETSURF_USE_ATARI_NETSURF_FONT := YES
+ # Enable VDI Font rendering
+ # Valid options: YES, NO
+ NETSURF_USE_ATARI_VDI_FONT := NO
+
# Configure support for screen drivers with no true colour mode
# Valid options: YES, NO
NETSURF_USE_ATARI_8BPP_SUPPORT := NO
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 169e3c7..d339292 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -40,6 +40,7 @@ $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng)))
$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript
(Spidermonkey)))
$(eval $(call
feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype)))
$(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal
Font)))
+$(eval $(call feature_enabled,ATARI_VDI_FONT,-DWITH_VDI_FONT_DRIVER,,(Internal Font)))
$(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen
format support)))
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
@@ -104,6 +105,7 @@ S_ATARI := \
plot/eddi.s \
plot/font_freetype.c \
plot/font_internal.c \
+ plot/font_vdi.c \
gemtk/aestabs.c \
gemtk/dragdrop.c \
gemtk/guiwin.c \
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index a82824e..d89060a 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -128,7 +128,7 @@ void context_popup(struct gui_window * gw, short x, short y)
char cmdline[PATH_MAX];
MENU pop_menu, me_data;
- pop = get_tree( POP_CTX );
+ pop = gemtk_obj_get_tree( POP_CTX );
if (pop == NULL)
return;
ctx = get_context_info(gw, x, y);
@@ -163,7 +163,7 @@ void context_popup(struct gui_window * gw, short x, short y)
}
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_CTX);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_CTX);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_CTX_CUT_SEL;
pop_menu.mn_scroll = SCROLL_NO;
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index d4621a3..df31ba0 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -268,8 +268,13 @@ static void __CDECL menu_find(short item, short title, void *data)
{
static bool visible = false;
LOG(("%s", __FUNCTION__));
- if( input_window != NULL ){
- window_open_search(input_window->root, true);
+ if (input_window != NULL) {
+ if (input_window->search) {
+ window_close_search(input_window->root);
+ }
+ else {
+ window_open_search(input_window->root, true);
+ }
}
}
@@ -314,7 +319,7 @@ static void __CDECL menu_savewin(short item, short title, void *data)
LOG(("%s", __FUNCTION__));
if (input_window && input_window->browser) {
GRECT rect;
- wind_get_grect(guiwin_get_handle(input_window->root->win), WF_CURRXYWH,
+ wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH,
&rect);
option_window_width = rect.g_w;
option_window_height = rect.g_h;
@@ -522,7 +527,7 @@ void deskmenu_init(void)
{
int i;
- h_gem_menu = get_tree(MAINMENU);
+ h_gem_menu = gemtk_obj_get_tree(MAINMENU);
/* Install menu: */
@@ -616,7 +621,7 @@ int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short
kstate,
bool done = 0;
int i = 0;
- sascii = keybd2ascii(kcode, K_LSHIFT);
+ sascii = gemtk_keybd2ascii(kcode, K_LSHIFT);
/* Iterate through the menu function table: */
while( menu_evnt_tbl[i].rid != -1 && done == false) {
diff --git a/atari/download.c b/atari/download.c
index d20fd88..936b8a5 100755
--- a/atari/download.c
+++ b/atari/download.c
@@ -61,7 +61,7 @@ static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip)
struct gui_download_window *data;
if (msg != WM_REDRAW) {
- data = guiwin_get_user_data(win);
+ data = gemtk_wm_get_user_data(win);
assert(data);
@@ -76,7 +76,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
GRECT clip;
- data = guiwin_get_user_data(win);
+ data = gemtk_wm_get_user_data(win);
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -133,7 +133,7 @@ static void on_redraw(struct gui_download_window *dw, GRECT *clip)
GRECT work, visible;
uint32_t p = 0;
- guiwin_get_grect(dw->guiwin, GUIWIN_AREA_TOOLBAR, &work);
+ gemtk_wm_get_grect(dw->guiwin, GEMTK_WM_AREA_TOOLBAR, &work);
tree->ob_x = work.g_x;
tree->ob_y = work.g_y;
@@ -175,7 +175,7 @@ static void on_abort_click(struct gui_download_window *dw)
{
if( dw->status == NSATARI_DOWNLOAD_COMPLETE
|| dw->status == NSATARI_DOWNLOAD_ERROR ) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
}
else if( dw->status != NSATARI_DOWNLOAD_CANCELED ){
dw->abort = true;
@@ -186,9 +186,9 @@ static void on_cbrdy_click(struct gui_download_window *dw)
{
dw->close_on_finish = !dw->close_on_finish;
if (dw->close_on_finish && dw->status == NSATARI_DOWNLOAD_COMPLETE) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0);
}
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
evnt_timer(250);
}
@@ -218,7 +218,7 @@ static void gui_download_window_destroy( struct gui_download_window *
gdw)
if (gdw->fbuf != NULL) {
free( gdw->fbuf );
}
- guiwin_remove(gdw->guiwin);
+ gemtk_wm_remove(gdw->guiwin);
wind_close(gdw->aes_handle);
wind_delete(gdw->aes_handle);
free(gdw);
@@ -256,7 +256,7 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
const char * url;
struct gui_download_window * gdw;
int dlgres = 0;
- OBJECT * tree = get_tree(DOWNLOAD);
+ OBJECT * tree = gemtk_obj_get_tree(DOWNLOAD);
char alert[200];
@@ -314,7 +314,7 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
if( gdw->fd == NULL ){
char spare[200];
snprintf(spare, 200, "Couldn't open %s for writing!",
gdw->destination);
- msg_box_show(MSG_BOX_ALERT, spare);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, spare);
gui_download_window_destroy(gdw);
return( NULL );
}
@@ -326,16 +326,16 @@ struct gui_download_window *
gui_download_window_create(download_context *ctx,
gdw->aes_handle = wind_create_grect(CLOSER | NAME | MOVER, &desk_area);
wind_set_str(gdw->aes_handle, WF_NAME, "Download");
- unsigned long gwflags = GW_FLAG_DEFAULTS;
- gdw->guiwin = guiwin_add(gdw->aes_handle, gwflags, on_aes_event);
+ unsigned long gwflags = GEMTK_WM_FLAG_DEFAULTS;
+ gdw->guiwin = gemtk_wm_add(gdw->aes_handle, gwflags, on_aes_event);
if( gdw->guiwin == NULL || gdw->fd == NULL ){
die("could not create guiwin");
gui_download_window_destroy(gdw);
return( NULL );
}
- guiwin_set_user_data(gdw->guiwin, gdw);
- guiwin_set_toolbar(gdw->guiwin, tree, 0, 0);
- guiwin_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
+ gemtk_wm_set_user_data(gdw->guiwin, gdw);
+ gemtk_wm_set_toolbar(gdw->guiwin, tree, 0, 0);
+ gemtk_wm_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
strncpy((char*)&gdw->lbl_file, filename, MAX_SLEN_LBL_FILE-1);
LOG(("created download: %s (total size: %d)",
@@ -379,7 +379,7 @@ nserror gui_download_window_data(struct gui_download_window *dw,
dw->status = NSATARI_DOWNLOAD_CANCELED;
dw->abort = false;
download_context_abort(dw->ctx);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
return(NSERROR_OK);
}
@@ -411,7 +411,7 @@ nserror gui_download_window_data(struct gui_download_window *dw,
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : "?"
);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
}
return NSERROR_OK;
}
@@ -422,7 +422,7 @@ void gui_download_window_error(struct gui_download_window *dw,
LOG(("%s", error_msg));
strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1);
dw->status = NSATARI_DOWNLOAD_ERROR;
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
gui_window_set_status(input_window, messages_get("Done") );
// TODO: change abort to close
}
@@ -442,7 +442,7 @@ void gui_download_window_done(struct gui_download_window *dw)
tree = dw->tree;
if (dw->close_on_finish) {
- guiwin_send_msg(dw->guiwin, WM_CLOSED, 0, 0, 0, 0);
+ gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0, 0, 0, 0);
} else {
snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
"%lu%s", 100, "%"
@@ -451,7 +451,7 @@ void gui_download_window_done(struct gui_download_window *dw)
human_friendly_bytesize(dw->size_downloaded),
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) :
human_friendly_bytesize(dw->size_downloaded)
);
- guiwin_send_redraw(dw->guiwin, NULL);
+ gemtk_wm_send_redraw(dw->guiwin, NULL);
}
gui_window_set_status(input_window, messages_get("Done") );
}
diff --git a/atari/encoding.c b/atari/encoding.c
index 2cd2670..75d0fec 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -67,3 +67,5 @@ int atari_to_ucs4(unsigned char atari)
ucs4 = (int)atari;
return( ucs4 );
}
+
+
diff --git a/atari/gemtk/dragdrop.c b/atari/gemtk/dragdrop.c
index e4ae2da..a4b7b82 100755
--- a/atari/gemtk/dragdrop.c
+++ b/atari/gemtk/dragdrop.c
@@ -50,7 +50,7 @@ static long pipesig;
* -1: Fehler beim Erzeugen der Pipe
*/
-short ddcreate(short *pipe)
+short gemtk_dd_create(short *pipe)
{
long fd = -1;
@@ -83,7 +83,7 @@ short ddcreate(short *pipe)
/* Signalhandler konfigurieren */
- ddgetsig(&pipesig);
+ gemtk_dd_getsig(&pipesig);
return((short) fd);
@@ -113,7 +113,7 @@ short ddcreate(short *pipe)
* -3: Fehler bei appl_write()
*/
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate,
short pipeid)
+short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short
kstate, short pipeid)
{
char c;
short i, msg[8];
@@ -135,7 +135,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my,
short kst
if (i == 0)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-3);
}
@@ -148,7 +148,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my,
short kst
{
/* Timeout eingetreten */
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-2);
}
@@ -157,13 +157,13 @@ short ddmessage(short apid, short fd, short winid, short mx, short
my, short kst
if (Fread(fd, 1L, &c) != 1L)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
if (c != DD_OK)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -187,11 +187,11 @@ short ddmessage(short apid, short fd, short winid, short mx, short
my, short kst
* -1: Fehler beim Lesen aus der Pipe
*/
-short ddrexts(short fd, char *exts)
+short gemtk_dd_rexts(short fd, char *exts)
{
if (Fread(fd, DD_EXTSIZE, exts) != DD_EXTSIZE)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -204,7 +204,7 @@ short ddrexts(short fd, char *exts)
* Testet, ob der Empf�nger einen Datentyp akzeptiert
*
* Eingabeparameter:
-* fd - Filehandle (von ddcreate())
+* fd - Filehandle (von gemtk_dd_create())
* ext - Zeiger auf Datentyp (4 Bytes zB. "ARGS")
* text - Zeiger auf Datenbeschreibung (optional, zB. "DESKTOP args")
* name - Zeiger auf Datendateiname (optional, zB. "SAMPLE.TXT")
@@ -223,7 +223,7 @@ short ddrexts(short fd, char *exts)
* DD_CLIPBOARD - Drop erfolgte auf Clipboard
*/
-short ddstry(short fd, char *ext, char *text, char *name, long size)
+short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size)
{
char c;
short hdrlen, i;
@@ -264,11 +264,11 @@ short ddstry(short fd, char *ext, char *text, char *name, long
size)
* Pipe schlie�en (Drag&Drop beenden/abbrechen)
*/
-void ddclose(short fd)
+void gemtk_dd_close(short fd)
{
/* Signalhandler restaurieren */
- ddsetsig(pipesig);
+ gemtk_dd_setsig(pipesig);
Fclose(fd);
@@ -288,7 +288,7 @@ void ddclose(short fd)
* keine
*/
-void ddgetsig(long *oldsig)
+void gemtk_dd_getsig(long *oldsig)
{
*oldsig = (long) Psignal(SIGPIPE, (void *) SIG_IGN);
}
@@ -298,7 +298,7 @@ void ddgetsig(long *oldsig)
* Signalhandler nach D&D restaurieren
*
* Eingabeparameter:
-* oldsig - Alter Handlerwert (von ddgetsig)
+* oldsig - Alter Handlerwert (von gemtk_dd_getsig)
*
* Ausgabeparameter:
* keine
@@ -307,7 +307,7 @@ void ddgetsig(long *oldsig)
* keine
*/
-void ddsetsig(long oldsig)
+void gemtk_dd_setsig(long oldsig)
{
if (oldsig != -32L)
Psignal(SIGPIPE, (void *) oldsig);
@@ -332,7 +332,7 @@ void ddsetsig(long oldsig)
* -1 - Drag&Drop abgebrochen
*/
-short ddopen(short ddnam, char ddmsg)
+short gemtk_dd_open(short ddnam, char ddmsg)
{
long fd;
@@ -347,12 +347,12 @@ short ddopen(short ddnam, char ddmsg)
/* Signalhandler konfigurieren */
- ddgetsig(&pipesig);
+ gemtk_dd_getsig(&pipesig);
if (Fwrite((short) fd, 1L, &ddmsg) != 1L)
{
- ddclose((short) fd);
+ gemtk_dd_close((short) fd);
return(-1);
}
@@ -380,11 +380,11 @@ short ddopen(short ddnam, char ddmsg)
* -1: Fehler beim Schreiben in die Pipe
*/
-short ddsexts(short fd, char *exts)
+short gemtk_dd_sexts(short fd, char *exts)
{
if (Fwrite(fd, DD_EXTSIZE, exts) != DD_EXTSIZE)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
@@ -397,7 +397,7 @@ short ddsexts(short fd, char *exts)
* N�chsten Header vom Sender holen
*
* Eingabeparameter:
-* fd - Filehandle der Pipe (von ddopen())
+* fd - Filehandle der Pipe (von gemtk_dd_open())
*
* Ausgabeparameters:
* name - Zeiger auf Buffer f�r Datenbeschreibung (min. DD_NAMEMAX!)
@@ -419,7 +419,7 @@ short ddsexts(short fd, char *exts)
* les string sont limit� a 128 octets
*/
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size)
+short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size)
{
char buf[DD_NAMEMAX * 2];
short hdrlen, i, len;
@@ -490,7 +490,7 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long
*size)
* Sendet der Senderapplikation eine 1 Byte Antwort
*
* Eingabeparameter:
-* fd - Filehandle der Pipe (von ddopen())
+* fd - Filehandle der Pipe (von gemtk_dd_open())
* ack - Byte das gesendet werden soll (zB. DD_OK)
*
* Ausgabeparameter:
@@ -501,11 +501,11 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long
*size)
* -1: Fehler (die Pipe wird automatisch geschlossen!)
*/
-short ddreply(short fd, char ack)
+short gemtk_dd_reply(short fd, char ack)
{
if (Fwrite(fd, 1L, &ack) != 1L)
{
- ddclose(fd);
+ gemtk_dd_close(fd);
return(-1);
}
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index e31fc8e..1853e75 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -37,12 +37,12 @@ unsigned short _systype (void);
* Chech for GRECT intersection without modifiend the src rectangles
* return true when the GRECT's intersect, fals otherwise.
*/
-bool rc_intersect_ro(GRECT *a, GRECT *b);
+bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b);
/*
* Convert keycode returned by evnt_multi to ascii value
*/
-int keybd2ascii( int keybd, int shift);
+int gemtk_keybd2ascii( int keybd, int shift);
/** set VDI clip area by passing an GRECT */
void gemtk_clip_grect(VdiHdl vh, GRECT *rect);
@@ -75,45 +75,44 @@ void gemtk_clip_grect(VdiHdl vh, GRECT *rect);
/* -------------------------------------------------------------------------- */
/* MultiTOS Drag & Drop */
/* -------------------------------------------------------------------------- */
-short ddcreate(short *pipe);
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate,
short pipename);
-short ddrexts(short fd, char *exts);
-short ddstry(short fd, char *ext, char *text, char *name, long size);
-void ddclose(short fd);
-void ddgetsig(long *oldsig);
-void ddsetsig(long oldsig);
-short ddopen(short ddnam, char ddmsg);
-short ddsexts(short fd, char *exts);
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
-short ddreply(short fd, char ack);
+short gemtk_dd_create(short *pipe);
+short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short
kstate, short pipename);
+short gemtk_dd_rexts(short fd, char *exts);
+short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size);
+void gemtk_dd_close(short fd);
+void gemtk_dd_getsig(long *oldsig);
+void gemtk_dd_setsig(long oldsig);
+short gemtk_dd_open(short ddnam, char ddmsg);
+short gemtk_dd_sexts(short fd, char *exts);
+short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size);
+short gemtk_dd_reply(short fd, char ack);
/* -------------------------------------------------------------------------- */
/* Message Box module */
/* -------------------------------------------------------------------------- */
-#define MSG_BOX_ALERT 1
-#define MSG_BOX_CONFIRM 2
+#define GEMTK_MSG_BOX_ALERT 1
+#define GEMTK_MSG_BOX_CONFIRM 2
-short msg_box_show(short type, const char * msg);
+short gemtk_msg_box_show(short type, const char * msg);
/* -------------------------------------------------------------------------- */
/* GUIWIN Module */
/* -------------------------------------------------------------------------- */
-#define GW_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events
-#define GW_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed
-#define GW_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical
-#define GW_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
-#define GW_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling
+#define GEMTK_WM_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events
+#define GEMTK_WM_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed
+#define GEMTK_WM_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical
+#define GEMTK_WM_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
+#define GEMTK_WM_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling
-#define GW_FLAG_DEFAULTS (GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM)
+#define GEMTK_WM_FLAG_DEFAULTS \
+ (GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM)
-#define GW_STATUS_ICONIFIED 0x01
-#define GW_STATUS_SHADED 0x02
+#define GEMTK_WM_STATUS_ICONIFIED 0x01
+#define GEMTK_WM_STATUS_SHADED 0x02
-#define GW_CB_SELECTED (OS_SELECTED)
-
-#define GUIWIN_VSLIDER 0x01
-#define GUIWIN_HSLIDER 0x02
-#define GUIWIN_VH_SLIDER 0x03
+#define GEMTK_WM_VSLIDER 0x01
+#define GEMTK_WM_HSLIDER 0x02
+#define GEMTK_WM_VH_SLIDER 0x03
/*
Message sent to the client application when an AES object is
@@ -124,20 +123,21 @@ short msg_box_show(short type, const char * msg);
msg[5] = Number of clicks.
msg[6] = Modifier keys.
*/
-#define GUIWIN_WM_FORM 1001
+#define GEMTK_WM_WM_FORM_CLICK 1001
+#define GEMTK_WM_WM_FORM_KEY 1002
-struct gui_window_s;
+struct gemtk_window_s;
/** list struct for managing AES windows */
-typedef struct gui_window_s GUIWIN;
+typedef struct gemtk_window_s GUIWIN;
/** GUIWIN event handler */
-typedef short (*guiwin_event_handler_f)(GUIWIN *gw,
+typedef short (*gemtk_wm_event_handler_f)(GUIWIN *gw,
EVMULT_OUT *ev_out, short msg[8]);
-typedef void (*guiwin_redraw_f)(GUIWIN *win, uint16_t msg, GRECT *clip);
+typedef void (*gemtk_wm_redraw_f)(GUIWIN *win, uint16_t msg, GRECT *clip);
-struct guiwin_scroll_info_s {
+struct gemtk_wm_scroll_info_s {
/** Definition of a content unit (horizontal) measured in pixel */
int x_unit_px;
@@ -160,9 +160,9 @@ struct guiwin_scroll_info_s {
/** Well known areas inside the window */
enum guwin_area_e {
- GUIWIN_AREA_WORK = 0,
- GUIWIN_AREA_TOOLBAR,
- GUIWIN_AREA_CONTENT
+ GEMTK_WM_AREA_WORK = 0,
+ GEMTK_WM_AREA_TOOLBAR,
+ GEMTK_WM_AREA_CONTENT
};
/* -------------------------------------------------------------------------- */
@@ -170,67 +170,74 @@ enum guwin_area_e {
/* -------------------------------------------------------------------------- */
short
-guiwin_init(void);
+gemtk_wm_init(void);
+
+void gemtk_wm_exit(void);
+
+GUIWIN * gemtk_wm_add(short handle, uint32_t flags,
+ gemtk_wm_event_handler_f handler);
-void
-guiwin_exit(void);
+GUIWIN * gemtk_wm_find(short handle);
-GUIWIN * guiwin_add(short handle, uint32_t flags,
- guiwin_event_handler_f handler);
+short gemtk_wm_remove(GUIWIN *win);
-GUIWIN * guiwin_find(short handle);
+GUIWIN * gemtk_wm_validate_ptr(GUIWIN *win);
-short guiwin_remove(GUIWIN *win);
+GUIWIN *gemtk_wm_link(GUIWIN *win);
-GUIWIN * guiwin_validate_ptr(GUIWIN *win);
+GUIWIN *gemtk_wm_unlink(GUIWIN *win);
-short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]);
+short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]);
-void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest);
+void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest);
-short guiwin_get_handle(GUIWIN *win);
+short gemtk_wm_get_handle(GUIWIN *win);
-uint32_t guiwin_get_state(GUIWIN *win);
+uint32_t gemtk_wm_get_state(GUIWIN *win);
-void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
+void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
uint32_t flags);
-void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f cb);
+void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb);
-void guiwin_set_user_data(GUIWIN *win, void *data);
+void gemtk_wm_set_user_data(GUIWIN *win, void *data);
-void * guiwin_get_user_data(GUIWIN *win);
+void * gemtk_wm_get_user_data(GUIWIN *win);
-struct guiwin_scroll_info_s * guiwin_get_scroll_info(GUIWIN *win);
+struct gemtk_wm_scroll_info_s * gemtk_wm_get_scroll_info(GUIWIN *win);
-void guiwin_set_scroll_grid(GUIWIN * win, short x, short y);
+void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y);
-void guiwin_set_content_units(GUIWIN * win, short x, short y);
+void gemtk_wm_set_content_units(GUIWIN * win, short x, short y);
-void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index);
+void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index);
-void guiwin_set_toolbar_size(GUIWIN *win, uint16_t s);
+void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s);
-void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f func);
+void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn);
-bool guiwin_update_slider(GUIWIN *win, short mode);
+void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func);
-void guiwin_scroll(GUIWIN *gw, short orientation, int units, bool refresh);
+bool gemtk_wm_update_slider(GUIWIN *win, short mode);
-void guiwin_send_msg(GUIWIN *win, short msgtype, short a, short b, short c,
+void gemtk_wm_scroll(GUIWIN *gw, short orientation, int units, bool refresh);
+
+void gemtk_wm_send_msg(GUIWIN *win, short msgtype, short a, short b, short c,
short d);
-void guiwin_send_redraw(GUIWIN *win, GRECT *area);
+void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area);
+
+VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win);
-VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
+short getm_wm_get_toolbar_edit_obj(GUIWIN *win);
-bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
+bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work);
-void guiwin_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip);
+void gemtk_wm_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip);
-void guiwin_form_redraw(GUIWIN *gw, GRECT *clip);
+void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip);
-void guiwin_clear(GUIWIN *win);
+void gemtk_wm_clear(GUIWIN *win);
/* -------------------------------------------------------------------------- */
/* AES SCROLLER MODULE */
@@ -244,9 +251,10 @@ void guiwin_clear(GUIWIN *win);
/* AES OBJECT TREE TOOLS */
/* -------------------------------------------------------------------------- */
char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt);
-char *get_text(OBJECT * tree, short idx);
-GRECT * obj_screen_rect(OBJECT * tree, short obj);
-bool obj_is_inside(OBJECT * tree, short obj, GRECT *area);
-OBJECT *get_tree(int idx);
-void obj_mouse_sprite(OBJECT *tree, int index);
+char *gemtk_obj_get_text(OBJECT * tree, short idx);
+GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj);
+bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area);
+OBJECT *gemtk_obj_get_tree(int idx);
+void gemtk_obj_mouse_sprite(OBJECT *tree, int index);
+OBJECT *gemtk_obj_tree_copy(OBJECT *tree);
#endif // GEMTK_H_INCLUDED
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 097eb6e..0334e58 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -29,16 +29,16 @@
//#define DEBUG_PRINT(x) printf x
#define DEBUG_PRINT(x)
-struct gui_window_s {
+struct gemtk_window_s {
/** The AES handle of the window */
short handle;
/** the generic event handler function for events passed to the client */
- guiwin_event_handler_f handler_func;
+ gemtk_wm_event_handler_f handler_func;
/** The custom toolbar redraw function, if any */
- guiwin_redraw_f toolbar_redraw_func;
+ gemtk_wm_redraw_f toolbar_redraw_func;
/** window configuration */
uint32_t flags;
@@ -58,8 +58,8 @@ struct gui_window_s {
/** Describes the start of the toolbar tree (usually 0) */
short toolbar_idx;
- /** depending on the flag GW_FLAG_HAS_VTOOLBAR this defines the toolbar
- height or the toolbar width (GW_FLAG_HAS_VTOOLBAR means width).
+ /** depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this defines the toolbar
+ height or the toolbar width (GEMTK_WM_FLAG_HAS_VTOOLBAR means width).
*/
short toolbar_size;
@@ -76,13 +76,13 @@ struct gui_window_s {
short form_idx;
/** Scroll state */
- struct guiwin_scroll_info_s scroll_info;
+ struct gemtk_wm_scroll_info_s scroll_info;
/** Arbitary data set by the user */
void *user_data;
/** linked list items */
- struct gui_window_s *next, *prev;
+ struct gemtk_window_s *next, *prev;
};
static GUIWIN * winlist;
@@ -95,7 +95,7 @@ static void move_rect(GUIWIN * win, GRECT *rect, int dx, int dy)
long dum = 0L;
GRECT g;
- VdiHdl vh = guiwin_get_vdi_handle(win);
+ VdiHdl vh = gemtk_wm_get_vdi_handle(win);
while(!wind_update(BEG_UPDATE));
graf_mouse(M_OFF, 0L);
@@ -126,14 +126,14 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
GRECT g, g_ro, g2;
short retval = 1;
int val = 1, old_val;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
switch(msg[0]) {
case WM_HSLID:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
if(val != slid->x_pos) {
if (val < slid->x_pos) {
@@ -141,14 +141,14 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
} else {
val = val-slid->x_pos;
}
- guiwin_scroll(gw, GUIWIN_HSLIDER, val, false);
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, val, false);
}
break;
case WM_VSLID:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
wind_set(gw->handle, WF_VSLIDE, msg[4], 0, 0, 0);
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
val = (float)(slid->y_units-(g.g_h/slid->y_unit_px))/1000*(float)msg[4];
if(val != slid->y_pos) {
if (val < slid->y_pos) {
@@ -156,62 +156,62 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
} else {
val = val -slid->y_pos;
}
- guiwin_scroll(gw, GUIWIN_VSLIDER, val, false);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, val, false);
}
break;
case WM_ARROWED:
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
- slid = guiwin_get_scroll_info(gw);
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ slid = gemtk_wm_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
g_ro = g;
switch(msg[4]) {
case WA_UPPAGE:
/* scroll page up */
- guiwin_scroll(gw, GUIWIN_VSLIDER, -(g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -(g.g_h/slid->y_unit_px),
true);
break;
case WA_UPLINE:
/* scroll line up */
- guiwin_scroll(gw, GUIWIN_VSLIDER, -1, true);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -1, true);
break;
case WA_DNPAGE:
/* scroll page down */
- guiwin_scroll(gw, GUIWIN_VSLIDER, g.g_h/slid->y_unit_px,
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, g.g_h/slid->y_unit_px,
true);
break;
case WA_DNLINE:
/* scroll line down */
- guiwin_scroll(gw, GUIWIN_VSLIDER, +1, true);
+ gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, +1, true);
break;
case WA_LFPAGE:
/* scroll page left */
- guiwin_scroll(gw, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px),
true);
break;
case WA_LFLINE:
/* scroll line left */
- guiwin_scroll(gw, GUIWIN_HSLIDER, -1,
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -1,
true);
break;
case WA_RTPAGE:
/* scroll page right */
- guiwin_scroll(gw, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px),
true);
break;
case WA_RTLINE:
/* scroll line right */
- guiwin_scroll(gw, GUIWIN_HSLIDER, 1,
+ gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, 1,
true);
break;
@@ -231,8 +231,8 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
if (gw->form) {
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
- slid = guiwin_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g);
+ slid = gemtk_wm_get_scroll_info(gw);
gw->form[gw->form_idx].ob_x = g.g_x -
(slid->x_pos * slid->x_unit_px);
@@ -251,9 +251,9 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
g.g_h = MIN(msg[7], g2.g_h);
if(g2.g_w != g.g_w || g2.g_h != g.g_h) {
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, g.g_w, g.g_h);
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
- guiwin_send_redraw(gw, NULL);
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) {
+ gemtk_wm_send_redraw(gw, NULL);
}
}
}
@@ -268,45 +268,45 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
wind_get_grect(gw->handle, WF_PREVXYWH, &g);
}
wind_set_grect(gw->handle, WF_CURRXYWH, &g);
- if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
- guiwin_send_redraw(gw, NULL);
+ if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) {
+ gemtk_wm_send_redraw(gw, NULL);
}
}
break;
case WM_ICONIFY:
wind_set(gw->handle, WF_ICONIFY, msg[4], msg[5], msg[6], msg[7]);
- gw->state |= GW_STATUS_ICONIFIED;
+ gw->state |= GEMTK_WM_STATUS_ICONIFIED;
break;
case WM_UNICONIFY:
wind_set(gw->handle, WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7]);
- gw->state &= ~(GW_STATUS_ICONIFIED);
+ gw->state &= ~(GEMTK_WM_STATUS_ICONIFIED);
break;
case WM_SHADED:
- gw->state |= GW_STATUS_SHADED;
+ gw->state |= GEMTK_WM_STATUS_SHADED;
break;
case WM_UNSHADED:
- gw->state &= ~(GW_STATUS_SHADED);
+ gw->state &= ~(GEMTK_WM_STATUS_SHADED);
break;
case WM_REDRAW:
- if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) {
+ if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0) {
g.g_x = msg[4];
g.g_y = msg[5];
g.g_w = msg[6];
g.g_h = msg[7];
- guiwin_toolbar_redraw(gw, WM_REDRAW, &g);
+ gemtk_wm_toolbar_redraw(gw, WM_REDRAW, &g);
}
if (gw->form != NULL) {
g.g_x = msg[4];
g.g_y = msg[5];
g.g_w = msg[6];
g.g_h = msg[7];
- guiwin_form_redraw(gw, &g);
+ gemtk_wm_form_redraw(gw, &g);
}
break;
@@ -329,12 +329,12 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out,
short msg[8])
DEBUG_PRINT(("preproc_mu_button\n"));
// toolbar handling:
- if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0
+ if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0
&& gw->toolbar != NULL) {
GRECT tb_area;
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y, tb_area)) {
@@ -351,7 +351,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
DEBUG_PRINT(("Toolbar index: %d\n", obj_idx));
if (obj_idx > -1
&& (gw->toolbar[obj_idx].ob_state & OS_DISABLED)== 0
- && ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0)) {
+ && ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0)) {
uint16_t type = (gw->toolbar[obj_idx].ob_type & 0xFF);
uint16_t nextobj;
@@ -392,16 +392,16 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out,
short msg[8])
if (gw->form != NULL) {
GRECT content_area;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
DEBUG_PRINT(("preproc_mu_button: handling form click.\n"));
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &content_area);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &content_area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x,
ev_out->emo_mouse.p_y, content_area)) {
- slid = guiwin_get_scroll_info(gw);
+ slid = gemtk_wm_get_scroll_info(gw);
// adjust form position (considering window and scroll position):
gw->form[gw->form_idx].ob_x = content_area.g_x -
@@ -434,7 +434,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
}
short oldevents = ev_out->emo_events;
- short msg_out[8] = { GUIWIN_WM_FORM, gl_apid,
+ short msg_out[8] = { GEMTK_WM_WM_FORM_CLICK, gl_apid,
0, gw->handle,
gw->form_focus_obj, ev_out->emo_mclicks,
ev_out->emo_kmeta, 0
@@ -476,24 +476,17 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
if (next_edit_obj != gw->toolbar_edit_obj) {
- if(gw->toolbar_edit_obj != -1) {
- objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
- ev_out->emo_kreturn, &edit_idx,
- EDEND, gw->handle);
- }
-
- gw->toolbar_edit_obj = next_edit_obj;
-
- objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
- ev_out->emo_kreturn, &edit_idx,
- EDINIT, gw->handle);
+ gemtk_wm_set_toolbar_edit_obj(gw, next_edit_obj,
+ ev_out->emo_kreturn);
} else {
if(next_char > 13)
r = objc_wedit(gw->toolbar, gw->toolbar_edit_obj,
ev_out->emo_kreturn, &edit_idx,
EDCHAR, gw->handle);
}
- retval = 1;
+ //retval = 1;
+ /*gemtk_wm_send_msg(gw, GEMTK_WM_WM_FORM_KEY, gw->toolbar_edit_obj,
+ ev_out->emo_kreturn, 0, 0);*/
}
if((gw->form != NULL) && (gw->form_edit_obj > -1) ) {
@@ -534,14 +527,14 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short
msg[8])
* Event Dispatcher function. The guiwin API doesn't own an event loop,
* so you have to inform it for every event that you want it to handle.
*/
-short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
+short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
{
GUIWIN *dest;
short retval = 0;
bool handler_called = false;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
- DEBUG_PRINT(("guiwin_handle_event_multi_fast: %d (%x)\n", msg[0],
+ DEBUG_PRINT(("gemtk_wm_handle_event_multi_fast: %d (%x)\n", msg[0],
msg[0]));
switch (msg[0]) {
case WM_REDRAW:
@@ -565,12 +558,12 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
case AP_DRAGDROP:
case AP_TERM:
case AP_TFAIL:
- dest = guiwin_find(msg[3]);
+ dest = gemtk_wm_find(msg[3]);
if (dest) {
DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n",
dest, dest->handle, dest->flags, dest->handler_func));
- if (dest->flags&GW_FLAG_PREPROC_WM) {
+ if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) {
retval = preproc_wm(dest, ev_out, msg);
- if(((retval == 0)||(dest->flags&GW_FLAG_RECV_PREPROC_WM))) {
+ if(((retval ==
0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) {
retval = dest->handler_func(dest, ev_out, msg);
handler_called = true;
}
@@ -590,7 +583,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
h_aes = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
if(h_aes > 0 && (ev_out->emo_events != MU_TIMER)) {
- dest = guiwin_find(h_aes);
+ dest = gemtk_wm_find(h_aes);
if (dest == NULL || dest->handler_func == NULL)
return(0);
@@ -623,7 +616,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out,
short msg[8])
/**
* Initialises the guiwin API
*/
-short guiwin_init(void)
+short gemtk_wm_init(void)
{
if(v_vdi_h == -1) {
short dummy;
@@ -634,7 +627,7 @@ short guiwin_init(void)
return(0);
}
-void guiwin_exit(void)
+void gemtk_wm_exit(void)
{
v_clsvwk(v_vdi_h);
}
@@ -647,30 +640,18 @@ void guiwin_exit(void)
* \param flags Creation flags, configures how the AES window is handled
* \param cb event handler function for that window
*/
-GUIWIN * guiwin_add(short handle, uint32_t flags, guiwin_event_handler_f cb)
+GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb)
{
GUIWIN *win = calloc(sizeof(GUIWIN),1);
assert(win!=NULL);
- DEBUG_PRINT(("guiwin_add: %d, %p, cb: %p\n", handle, win, cb));
+ DEBUG_PRINT(("gemtk_wm_add: %d, %p, cb: %p\n", handle, win, cb));
win->handle = handle;
win->handler_func = cb;
win->flags = flags;
- if (winlist == NULL) {
- winlist = win;
- win->next = NULL;
- win->prev = NULL;
- } else {
- GUIWIN *tmp = winlist;
- while( tmp->next != NULL ) {
- tmp = tmp->next;
- }
- tmp->next = win;
- win->prev = tmp;
- win->next = NULL;
- }
+ gemtk_wm_link(win);
DEBUG_PRINT(("Added guiwin: %p, tb: %p\n", win, win->toolbar));
return(win);
@@ -679,7 +660,7 @@ GUIWIN * guiwin_add(short handle, uint32_t flags,
guiwin_event_handler_f cb)
/**
* Returns an GUIWIN* for AES handle, when that AES window is managed by guiwin
*/
-GUIWIN *guiwin_find(short handle)
+GUIWIN *gemtk_wm_find(short handle)
{
GUIWIN *g;
DEBUG_PRINT(("guiwin search handle: %d\n", handle));
@@ -696,28 +677,54 @@ GUIWIN *guiwin_find(short handle)
/**
* Check's if the pointer is managed by the guiwin API.
*/
-GUIWIN *guiwin_validate_ptr(GUIWIN *win)
+GUIWIN *gemtk_wm_validate_ptr(GUIWIN *win)
{
GUIWIN *g;
for( g = winlist; g != NULL; g=g->next ) {
- DEBUG_PRINT(("guiwin guiwin_validate_ptr check: %p\n", g));
+ DEBUG_PRINT(("guiwin gemtk_wm_validate_ptr check: %p\n", g));
if(g == win) {
- DEBUG_PRINT(("guiwin_validate_ptr valid: %p\n", g));
+ DEBUG_PRINT(("gemtk_wm_validate_ptr valid: %p\n", g));
return(g);
}
}
return(NULL);
}
-/**
-* Remove an GUIWIN from the list of managed windows.
-* Call this when the AES window is closed or deleted.
-*/
-short guiwin_remove(GUIWIN *win)
+GUIWIN *gemtk_wm_link(GUIWIN *win)
+{
+ /* Make sure the window is not linked: */
+ GUIWIN *win_val = gemtk_wm_validate_ptr(win);
+ if(win_val){
+ DEBUG_PRINT(("GUIWIN %p is already linked!\n", win));
+ return(NULL);
+ }
+
+ if (winlist == NULL) {
+ winlist = win;
+ win->next = NULL;
+ win->prev = NULL;
+ } else {
+ GUIWIN *tmp = winlist;
+ while( tmp->next != NULL ) {
+ tmp = tmp->next;
+ }
+ tmp->next = win;
+ win->prev = tmp;
+ win->next = NULL;
+ }
+}
+
+GUIWIN *gemtk_wm_unlink(GUIWIN *win)
{
- win = guiwin_validate_ptr(win);
- if (win == NULL)
- return(-1);
+ GUIWIN * win_val;
+
+ /* Make sure the window is linked: */
+ win_val = gemtk_wm_validate_ptr(win);
+ if (win_val == NULL){
+ DEBUG_PRINT(("GUIWIN %p is not linked!\n", win));
+ return(NULL);
+ }
+
/* unlink the window: */
if(win->prev != NULL ) {
@@ -728,6 +735,16 @@ short guiwin_remove(GUIWIN *win)
if (win->next != NULL) {
win->next->prev = win->prev;
}
+ return(win);
+}
+
+/**
+* Remove an GUIWIN from the list of managed windows and free the GUIWIN.
+* Call this when the AES window is closed or deleted.
+*/
+short gemtk_wm_remove(GUIWIN *win)
+{
+ gemtk_wm_unlink(win);
DEBUG_PRINT(("guiwin free: %p\n", win));
free(win);
return(0);
@@ -738,17 +755,17 @@ short guiwin_remove(GUIWIN *win)
* \param mode Specifies the area to retrieve.
* \param dest The calculated rectangle.
*/
-void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest)
+void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest)
{
assert(win != NULL);
wind_get_grect(win->handle, WF_WORKXYWH, dest);
- if (mode == GUIWIN_AREA_CONTENT) {
+ if (mode == GEMTK_WM_AREA_CONTENT) {
GRECT tb_area;
- guiwin_get_grect(win, GUIWIN_AREA_TOOLBAR, &tb_area);
- if (win->flags & GW_FLAG_HAS_VTOOLBAR) {
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &tb_area);
+ if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
dest->g_x += tb_area.g_w;
dest->g_w -= tb_area.g_w;
}
@@ -756,9 +773,9 @@ void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT
*dest)
dest->g_y += tb_area.g_h;
dest->g_h -= tb_area.g_h;
}
- } else if (mode == GUIWIN_AREA_TOOLBAR) {
+ } else if (mode == GEMTK_WM_AREA_TOOLBAR) {
if (win->toolbar) {
- if (win->flags & GW_FLAG_HAS_VTOOLBAR) {
+ if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
dest->g_w = win->toolbar_size;
} else {
dest->g_h = win->toolbar_size;
@@ -773,24 +790,24 @@ void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT
*dest)
/**
-* Scroll the content area (GUIWIN_AREA_CONTENT) in the specified dimension
-* (GUIWIN_VSLIDER, GUIWIN_HSLIDER)
+* Scroll the content area (GEMTK_WM_AREA_CONTENT) in the specified dimension
+* (GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER)
* \param win The GUIWIN
-* \param orientation GUIWIN_VSLIDER or GUIWIN_HSLIDER
+* \param orientation GEMTK_WM_VSLIDER or GEMTK_WM_HSLIDER
* \param units the amout to scroll (pass negative values to scroll up)
* \param refresh Sliders will be updated when this flag is set
*/
-void guiwin_scroll(GUIWIN *win, short orientation, int units, bool refresh)
+void gemtk_wm_scroll(GUIWIN *win, short orientation, int units, bool refresh)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
int oldpos = 0, newpos = 0, vis_units=0, pix = 0;
int abs_pix = 0;
GRECT *redraw=NULL, g, g_ro;
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &g);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &g);
g_ro = g;
- if (orientation == GUIWIN_VSLIDER) {
+ if (orientation == GEMTK_WM_VSLIDER) {
pix = units*slid->y_unit_px;
abs_pix = abs(pix);
oldpos = slid->y_pos;
@@ -803,7 +820,7 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
if(oldpos == newpos)
return;
- if (units>=vis_units || guiwin_has_intersection(win, &g_ro)) {
+ if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) {
// send complete redraw
redraw = &g_ro;
} else {
@@ -839,7 +856,7 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
if(oldpos == newpos)
return;
- if (units>=vis_units || guiwin_has_intersection(win, &g_ro)) {
+ if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) {
// send complete redraw
redraw = &g_ro;
} else {
@@ -864,36 +881,36 @@ void guiwin_scroll(GUIWIN *win, short orientation, int units, bool
refresh)
}
if (refresh) {
- guiwin_update_slider(win, orientation);
+ gemtk_wm_update_slider(win, orientation);
}
if ((redraw != NULL) && (redraw->g_h > 0)) {
- guiwin_send_redraw(win, redraw);
+ gemtk_wm_send_redraw(win, redraw);
}
}
/**
* Refresh the sliders of the window.
* \param win the GUIWIN
-* \param mode bitmask, valid bits: GUIWIN_VSLIDER, GUIWIN_HSLIDER
+* \param mode bitmask, valid bits: GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER
*/
-bool guiwin_update_slider(GUIWIN *win, short mode)
+bool gemtk_wm_update_slider(GUIWIN *win, short mode)
{
GRECT viewport;
- struct guiwin_scroll_info_s * slid;
+ struct gemtk_wm_scroll_info_s * slid;
unsigned long size, pos;
int old_x, old_y;
- short handle = guiwin_get_handle(win);
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &viewport);
- slid = guiwin_get_scroll_info(win);
+ short handle = gemtk_wm_get_handle(win);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &viewport);
+ slid = gemtk_wm_get_scroll_info(win);
old_x = slid->x_pos;
old_y = slid->y_pos;
// TODO: check if the window has sliders of that direction...?
- if((mode & GUIWIN_VSLIDER) && (slid->y_unit_px > 0)) {
+ if((mode & GEMTK_WM_VSLIDER) && (slid->y_unit_px > 0)) {
if ( slid->y_units < (long)viewport.g_h/slid->y_unit_px) {
size = 1000L;
} else
@@ -910,7 +927,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
wind_set(handle, WF_VSLIDE, 0, 0, 0, 0);
}
}
- if((mode & GUIWIN_HSLIDER) && (slid->x_unit_px > 0)) {
+ if((mode & GEMTK_WM_HSLIDER) && (slid->x_unit_px > 0)) {
if ( slid->x_units < (long)viewport.g_w/slid->x_unit_px)
size = 1000L;
else
@@ -937,7 +954,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
/**
* Return the AES handle for the GUIWIN.
*/
-short guiwin_get_handle(GUIWIN *win)
+short gemtk_wm_get_handle(GUIWIN *win)
{
return(win->handle);
}
@@ -945,7 +962,7 @@ short guiwin_get_handle(GUIWIN *win)
/**
* Return the VDI handle for an GUIWIN.
*/
-VdiHdl guiwin_get_vdi_handle(GUIWIN *win)
+VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win)
{
return(v_vdi_h);
}
@@ -953,7 +970,7 @@ VdiHdl guiwin_get_vdi_handle(GUIWIN *win)
/**
* Returns the state bitmask of the window
*/
-uint32_t guiwin_get_state(GUIWIN *win)
+uint32_t gemtk_wm_get_state(GUIWIN *win)
{
return(win->state);
}
@@ -962,7 +979,7 @@ uint32_t guiwin_get_state(GUIWIN *win)
/**
* Set and new event handler function.
*/
-void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f cb)
+void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb)
{
win->handler_func = cb;
}
@@ -976,13 +993,13 @@ void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f
cb)
* \param flags optional configuration flags
*/
//TODO: document flags
-void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, uint32_t flags)
+void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, uint32_t flags)
{
win->toolbar = toolbar;
win->toolbar_idx = idx;
win->toolbar_edit_obj = -1;
- if (flags & GW_FLAG_HAS_VTOOLBAR) {
- win->flags |= GW_FLAG_HAS_VTOOLBAR;
+ if (flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) {
+ win->flags |= GEMTK_WM_FLAG_HAS_VTOOLBAR;
win->toolbar_size = win->toolbar[idx].ob_width;
}
else {
@@ -992,19 +1009,43 @@ void guiwin_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx,
uint32_t flags)
/** Update width/height of the toolbar region
* \param win the GUIWIN
-* \param s depending on the flag GW_FLAG_HAS_VTOOLBAR this is the width or the height
+* \param s depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this is the width or the
height
*/
-void guiwin_set_toolbar_size(GUIWIN *win, uint16_t s)
+void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s)
{
win->toolbar_size = s;
}
+short getm_wm_get_toolbar_edit_obj(GUIWIN *win)
+{
+ return(win->toolbar_edit_obj);
+}
+
+/** Set the current active edit object */
+void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn)
+{
+ short edit_idx;
+
+ if (obj != win->toolbar_edit_obj) {
+
+ if(win->toolbar_edit_obj != -1) {
+ objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx,
+ EDEND, win->handle);
+ }
+
+ win->toolbar_edit_obj = obj;
+
+ objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx,
+ EDINIT, win->handle);
+ }
+}
+
/** Set an custom toolbar redraw function which is called instead of
* default drawing routine.
* \param win the GUIWIN
* \param func the custom redraw function
*/
-void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f func)
+void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func)
{
win->toolbar_redraw_func = func;
}
@@ -1012,7 +1053,7 @@ void guiwin_set_toolbar_redraw_func(GUIWIN *win, guiwin_redraw_f
func)
/**
* Attach an arbitary pointer to the GUIWIN
*/
-void guiwin_set_user_data(GUIWIN *win, void *data)
+void gemtk_wm_set_user_data(GUIWIN *win, void *data)
{
win->user_data = data;
}
@@ -1020,14 +1061,14 @@ void guiwin_set_user_data(GUIWIN *win, void *data)
/**
* Retrieve the user_data pointer attached to the GUIWIN.
*/
-void *guiwin_get_user_data(GUIWIN *win)
+void *gemtk_wm_get_user_data(GUIWIN *win)
{
return(win->user_data);
}
/** Get the scroll management structure for a GUIWIN
*/
-struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win) {
+struct gemtk_wm_scroll_info_s *gemtk_wm_get_scroll_info(GUIWIN *win) {
return(&win->scroll_info);
}
@@ -1035,9 +1076,9 @@ struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win) {
* Get the amount of content dimensions within the window
* which is calculated by using the scroll_info attached to the GUIWIN.
*/
-void guiwin_set_scroll_grid(GUIWIN * win, short x, short y)
+void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
assert(slid != NULL);
@@ -1051,9 +1092,9 @@ void guiwin_set_scroll_grid(GUIWIN * win, short x, short y)
* \param x horizontal size
* \param y vertical size
*/
-void guiwin_set_content_units(GUIWIN * win, short x, short y)
+void gemtk_wm_set_content_units(GUIWIN * win, short x, short y)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win);
assert(slid != NULL);
@@ -1069,7 +1110,7 @@ void guiwin_set_content_units(GUIWIN * win, short x, short y)
* \param c the 6th parameter to appl_write
* \param d the 7th parameter to appl_write
*/
-void guiwin_send_msg(GUIWIN *win, short msg_type, short a, short b, short c,
+void gemtk_wm_send_msg(GUIWIN *win, short msg_type, short a, short b, short c,
short d)
{
short msg[8];
@@ -1086,8 +1127,8 @@ void guiwin_send_msg(GUIWIN *win, short msg_type, short a, short b,
short c,
appl_write(gl_apid, 16, &msg);
}
-// TODO: rename, document and implement alternative (guiwin_exec_event)
-void guiwin_send_redraw(GUIWIN *win, GRECT *area)
+// TODO: rename, document and implement alternative (gemtk_wm_exec_event)
+void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area)
{
short msg[8], retval;
GRECT work;
@@ -1107,10 +1148,10 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
EVMULT_OUT event_out;
if (area == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &work);
if (work.g_w < 1 || work.g_h < 1) {
if (win->toolbar != NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_TOOLBAR, &work);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &work);
if (work.g_w < 1 || work.g_h < 1) {
return;
}
@@ -1130,7 +1171,7 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
event_out.emo_events = MU_MESAG;
retval = preproc_wm(win, &event_out, msg);
- if (retval == 0 || (win->flags & GW_FLAG_PREPROC_WM) != 0){
+ if (retval == 0 || (win->flags & GEMTK_WM_FLAG_PREPROC_WM) != 0){
win->handler_func(win, &event_out, msg);
}
@@ -1141,7 +1182,7 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
/** Attach an AES FORM to the GUIWIN, similar feature like the toolbar
*/
-void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index)
+void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index)
{
DEBUG_PRINT(("Setting form %p (%d) for window %p\n", tree, index, win));
win->form = tree;
@@ -1152,13 +1193,13 @@ void guiwin_set_form(GUIWIN *win, OBJECT *tree, short index)
/** Checks if a GUIWIN is overlapped by other windows.
*/
-bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
+bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work)
{
GRECT area, mywork;
bool retval = true;
if (work == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &mywork);
work = &mywork;
}
@@ -1178,11 +1219,11 @@ bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
* \param msg specifies the AES message which initiated the redraw, or 0 when
* the function was called without AES message context.
*/
-void guiwin_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
+void gemtk_wm_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
{
GRECT tb_area, tb_area_ro, g;
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area_ro);
if(clip == NULL) {
clip = &tb_area_ro;
@@ -1222,19 +1263,19 @@ void guiwin_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip)
/** Execute FORM redraw
*/
-void guiwin_form_redraw(GUIWIN *gw, GRECT *clip)
+void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip)
{
GRECT area, area_ro, g;
int scroll_px_x, scroll_px_y;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
//int new_x, new_y, old_x, old_y;
short edit_idx;
- DEBUG_PRINT(("guiwin_form_redraw\n"));
+ DEBUG_PRINT(("gemtk_wm_form_redraw\n"));
// calculate form coordinates, include scrolling:
- guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &area_ro);
- slid = guiwin_get_scroll_info(gw);
+ gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &area_ro);
+ slid = gemtk_wm_get_scroll_info(gw);
// Update form position:
gw->form[gw->form_idx].ob_x = area_ro.g_x - (slid->x_pos *
slid->x_unit_px);
@@ -1264,19 +1305,19 @@ void guiwin_form_redraw(GUIWIN *gw, GRECT *clip)
/** Fill the content area with white color
*/
-void guiwin_clear(GUIWIN *win)
+void gemtk_wm_clear(GUIWIN *win)
{
GRECT area, g;
short pxy[4];
VdiHdl vh;
- vh = guiwin_get_vdi_handle(win);
+ vh = gemtk_wm_get_vdi_handle(win);
- if(win->state & GW_STATUS_ICONIFIED) {
+ if(win->state & GEMTK_WM_STATUS_ICONIFIED) {
// also clear the toolbar area when iconified:
- guiwin_get_grect(win, GUIWIN_AREA_WORK, &area);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &area);
} else {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &area);
+ gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &area);
}
vsf_interior(vh, FIS_SOLID);
diff --git a/atari/gemtk/msgbox.c b/atari/gemtk/msgbox.c
index 770e0af..150bcc7 100644
--- a/atari/gemtk/msgbox.c
+++ b/atari/gemtk/msgbox.c
@@ -8,9 +8,9 @@
# define min(x,y) ((x<y) ? x : y )
#endif
-short msg_box_show(short type, const char * msg)
+short gemtk_msg_box_show(short type, const char * msg)
{
- #define MSG_BOX_STR_SIZE 256
+ #define GEMTK_MSG_BOX_STR_SIZE 256
short retval=0, i=0, z=0, l=0;
char c;
int len_msg = strlen(msg);
@@ -19,13 +19,13 @@ short msg_box_show(short type, const char * msg)
const char *str_yes = "Yes";
const char *str_no = "No";
const char *str_ok = "OK";
- char msg_box_str[MSG_BOX_STR_SIZE];
+ char msg_box_str[GEMTK_MSG_BOX_STR_SIZE];
char *dst = msg_box_str;
- memset(msg_box_str, 0, MSG_BOX_STR_SIZE);
+ memset(msg_box_str, 0, GEMTK_MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "[1]", MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "[", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "[1]", GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "[", GEMTK_MSG_BOX_STR_SIZE);
dst = msg_box_str + strlen(msg_box_str);
@@ -61,24 +61,24 @@ short msg_box_show(short type, const char * msg)
dst++;
}
}
- strncat(msg_box_str, "][", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "][", GEMTK_MSG_BOX_STR_SIZE);
- if(type == MSG_BOX_CONFIRM){
- strncat(msg_box_str, str_yes, MSG_BOX_STR_SIZE);
- strncat(msg_box_str, "|", MSG_BOX_STR_SIZE);
- strncat(msg_box_str, str_no, MSG_BOX_STR_SIZE);
+ if(type == GEMTK_MSG_BOX_CONFIRM){
+ strncat(msg_box_str, str_yes, GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "|", GEMTK_MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, str_no, GEMTK_MSG_BOX_STR_SIZE);
} else {
- strncat(msg_box_str, str_ok, MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, str_ok, GEMTK_MSG_BOX_STR_SIZE);
}
- strncat(msg_box_str, "]", MSG_BOX_STR_SIZE);
+ strncat(msg_box_str, "]", GEMTK_MSG_BOX_STR_SIZE);
retval = form_alert(type, msg_box_str);
- if(type == MSG_BOX_CONFIRM){
+ if(type == GEMTK_MSG_BOX_CONFIRM){
if(retval != 1){
retval = 0;
}
}
return(retval);
- #undef MSG_BOX_STR_SIZE
+ #undef GEMTK_MSG_BOX_STR_SIZE
}
diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c
index 3221fda..2a5eaae 100644
--- a/atari/gemtk/objc.c
+++ b/atari/gemtk/objc.c
@@ -1,131 +1,131 @@
-/*
- * Copyright 2013 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf,
http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <
http://www.gnu.org/licenses/>.
- *
- * Module Description:
- *
- * AES Object tree tools.
- *
+/*
+ * Copyright 2013 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ *
+ * Module Description:
+ *
+ * AES Object tree tools.
+ *
*/
#include <assert.h>
- #include "gemtk.h"
+#include "gemtk.h"
-char *get_text(OBJECT * tree, short idx)
+char *gemtk_obj_get_text(OBJECT * tree, short idx)
{
- static char p[]="";
- USERBLK *user;
- char *retval;
-
- switch (tree[idx].ob_type & 0x00FF) {
- case G_BUTTON:
- case G_STRING:
- case G_TITLE:
- return( tree[idx].ob_spec.free_string);
- case G_TEXT:
- case G_BOXTEXT:
- case G_FTEXT:
- case G_FBOXTEXT:
- return (tree[idx].ob_spec.tedinfo->te_ptext);
- case G_ICON:
- case G_CICON:
- return (tree[idx].ob_spec.iconblk->ib_ptext);
- break;
-
- default: break;
- }
- return (p);
+ static char p[]="";
+ USERBLK *user;
+ char *retval;
+
+ switch (tree[idx].ob_type & 0x00FF) {
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+ return( tree[idx].ob_spec.free_string);
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+ return (tree[idx].ob_spec.tedinfo->te_ptext);
+ case G_ICON:
+ case G_CICON:
+ return (tree[idx].ob_spec.iconblk->ib_ptext);
+ break;
+
+ default:
+ break;
+ }
+ return (p);
}
-static void set_text(OBJECT *obj, short idx, char * text, int len)
-{
- char spare[255];
-
- if( len > 254 )
- len = 254;
- if( text != NULL ){
- strncpy(spare, text, 254);
- } else {
- strcpy(spare, "");
- }
-
- set_string(obj, idx, spare);
+static void set_text(OBJECT *obj, short idx, char * text, int len)
+{
+ char spare[255];
+
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ) {
+ strncpy(spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ }
+
+ set_string(obj, idx, spare);
}
char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt)
{
- char spare[204];
- short type = 0;
- short maxlen = 0;
- TEDINFO *ted;
-
-
- type = (tree[idx].ob_type & 0xFF);
- if (type == G_FTEXT || type == G_FBOXTEXT) {
- TEDINFO *ted = ((TEDINFO *)get_obspec(tree, idx));
- maxlen = ted->te_txtlen+1;
- if (maxlen > 200) {
- maxlen = 200;
- }
- else if (maxlen < 0) {
- maxlen = 0;
- }
- } else {
- assert((type == G_FTEXT) || (type == G_FBOXTEXT));
- }
-
- snprintf(spare, maxlen, "%s", txt);
- set_string(tree, idx, spare);
+ char spare[204];
+ short type = 0;
+ short maxlen = 0;
+ TEDINFO *ted;
+
+
+ type = (tree[idx].ob_type & 0xFF);
+ if (type == G_FTEXT || type == G_FBOXTEXT) {
+ TEDINFO *ted = ((TEDINFO *)get_obspec(tree, idx));
+ maxlen = ted->te_txtlen+1;
+ if (maxlen > 200) {
+ maxlen = 200;
+ } else if (maxlen < 0) {
+ maxlen = 0;
+ }
+ } else {
+ assert((type == G_FTEXT) || (type == G_FBOXTEXT));
+ }
+
+ snprintf(spare, maxlen, "%s", txt);
+ set_string(tree, idx, spare);
}
-OBJECT *get_tree(int idx)
-{
+OBJECT *gemtk_obj_get_tree(int idx)
+{
+
+ OBJECT *tree;
- OBJECT *tree;
-
- rsrc_gaddr(R_TREE, idx, &tree);
-
- return tree;
+ rsrc_gaddr(R_TREE, idx, &tree);
+
+ return tree;
}
-bool obj_is_inside(OBJECT * tree, short obj, GRECT *area)
+bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area)
{
- GRECT obj_screen;
- bool ret = false;
+ GRECT obj_screen;
+ bool ret = false;
- objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
- obj_screen.g_w = tree[obj].ob_width;
- obj_screen.g_h = tree[obj].ob_height;
+ objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y);
+ obj_screen.g_w = tree[obj].ob_width;
+ obj_screen.g_h = tree[obj].ob_height;
- ret = RC_WITHIN(&obj_screen, area);
+ ret = RC_WITHIN(&obj_screen, area);
- return(ret);
+ return(ret);
}
-GRECT * obj_screen_rect(OBJECT * tree, short obj)
+GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj)
{
- static GRECT obj_screen;
+ static GRECT obj_screen;
- get_objframe(tree, obj, &obj_screen);
+ get_objframe(tree, obj, &obj_screen);
- return(&obj_screen);
+ return(&obj_screen);
}
-void obj_mouse_sprite(OBJECT *tree, int index)
+void gemtk_obj_mouse_sprite(OBJECT *tree, int index)
{
MFORM mform;
int dum;
@@ -146,3 +146,223 @@ void obj_mouse_sprite(OBJECT *tree, int index)
}
graf_mouse(USER_DEF, &mform);
}
+
+
+/*
+ * gemtk_obj_tree_copy
+ *
+ * Copy a complete object-tree including all substructures (optional).
+ *
+ * CAUTION: The object-tree *must* have the LASTOB-flag (0x20) set in
+ * it's physically last member.
+ *
+ * BUG: Up to now tree_copy won't copy the color-icon-structure,
+ * because I'm too lazy ;) Maybe I'll do that one day. If you need it
+ * urgently, contact me and force me to work... Btw, this doesn't mean
+ * that G_CICONs won't be copied at all, but the copied tree will
+ * share the CICONBLKs with the original.
+ *
+ * Input:
+ * tree: Pointer to tree which should be copied
+ * what: Specifies what substructures should be copied, too (see the
+ * C_xxx-definitions in tree-copy.h for details)
+ *
+ * Output:
+ * NULL: Tree couldn't be copied (due to lack of memory)
+ * otherwise: Pointer to copied tree, use free to dealloc it's memory
+ */
+OBJECT *gemtk_obj_tree_copy(OBJECT *tree)
+{
+ int16_t i, objects;
+ size_t to_malloc, size;
+ OBJECT *new_tree;
+ char *area;
+
+ /* Calculate the number of bytes we need for the new tree */
+ to_malloc = (size_t) 0;
+ for (i = 0;;) {
+
+ /* Size of the OBJECT-structure itself */
+ to_malloc += sizeof(OBJECT);
+
+ switch (tree[i].ob_type & 0xff) {
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+ /* Size of a TEDINFO-structure */
+ to_malloc += sizeof(TEDINFO);
+
+ /* Sizes of the strings in the TEDINFO-structure */
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen;
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen;
+ to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_tmplen;
+ break;
+
+ case G_IMAGE:
+
+ /* Size of the BITBLK-structure */
+ to_malloc += sizeof(BITBLK);
+
+ /* Size of the image-data in the BITBLK-structure */
+ to_malloc += (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb *
+ (int32_t)tree[i].ob_spec.bitblk->bi_hl);
+
+ break;
+
+ case G_USERDEF:
+ /* Size of the USERBLK-structure */
+ to_malloc += sizeof(USERBLK);
+ break;
+
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+ /* Size of the string (with one null character at the end) */
+ to_malloc += strlen(tree[i].ob_spec.free_string) + 1L;
+ break;
+
+ case G_ICON:
+ /* Size of the ICONBLK-structure */
+ to_malloc += sizeof(BITBLK);
+
+ /* Sizes of icon-data, icon-mask and icon-text */
+ to_malloc += (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon *
+ (int32_t)tree[i].ob_spec.iconblk->ib_hicon /
+ 4L + 1L +
+ (int32_t)strlen(tree[i].ob_spec.iconblk->ib_ptext));
+
+ break;
+ }
+
+ /* If the size is odd, make it even */
+ if ((long)to_malloc & 1)
+ to_malloc++;
+
+ /* Exit if we've reached the last object in the tree */
+ if (tree[i].ob_flags & OF_LASTOB)
+ break;
+
+ i++;
+ }
+
+ objects = i + 1;
+
+ /* If there's not enough memory left for the new tree, return NULL */
+ if ((new_tree = (OBJECT *)calloc(1, to_malloc)) == NULL) {
+ return(NULL);
+ }
+
+ /*
+ * area contains a pointer to the area where we copy the structures to
+ */
+ area = (char *)((int32_t)new_tree+(int32_t)objects*(int32_t)sizeof(OBJECT));
+
+ for (i = 0; i < objects; i++) {
+
+ /* Copy the contents of the OBJECT-structure */
+ new_tree[i] = tree[i];
+
+ /* This was added to assure true copies of the object type */
+ new_tree[i].ob_type = tree[i].ob_type;
+
+ switch (tree[i].ob_type & 0xff) {
+ case G_TEXT:
+ case G_BOXTEXT:
+ case G_FTEXT:
+ case G_FBOXTEXT:
+
+ /* Copy the contents of the TEDINFO-structure */
+ *(TEDINFO *)area = *tree[i].ob_spec.tedinfo;
+ new_tree[i].ob_spec.tedinfo = (TEDINFO *)area;
+ area += sizeof(TEDINFO);
+
+ /* Copy the strings in the TEDINFO-structure */
+ strncpy(area, tree[i].ob_spec.tedinfo->te_ptext,
+ tree[i].ob_spec.tedinfo->te_txtlen);
+ new_tree[i].ob_spec.tedinfo->te_ptext = area;
+ area += tree[i].ob_spec.tedinfo->te_txtlen;
+ strncpy(area, tree[i].ob_spec.tedinfo->te_ptmplt,
+ tree[i].ob_spec.tedinfo->te_tmplen);
+ new_tree[i].ob_spec.tedinfo->te_ptmplt = area;
+ area += tree[i].ob_spec.tedinfo->te_tmplen;
+ strncpy(area, tree[i].ob_spec.tedinfo->te_pvalid,
+ tree[i].ob_spec.tedinfo->te_txtlen);
+ new_tree[i].ob_spec.tedinfo->te_pvalid = area;
+ area += tree[i].ob_spec.tedinfo->te_txtlen;
+
+ break;
+
+ case G_IMAGE:
+
+ /* Copy the contents of the BITBLK-structure */
+ *(BITBLK *)area = *tree[i].ob_spec.bitblk;
+ new_tree[i].ob_spec.bitblk = (BITBLK *)area;
+ area += sizeof(BITBLK);
+
+ /* Copy the image-data */
+ size = (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb *
+ (int32_t)tree[i].ob_spec.bitblk->bi_hl);
+ memcpy(area, tree[i].ob_spec.bitblk->bi_pdata, size);
+ new_tree[i].ob_spec.bitblk->bi_pdata = (int16_t *)area;
+ area += size;
+
+ break;
+
+ case G_USERDEF:
+
+ /* Copy the contents of the USERBLK-structure */
+ *(USERBLK *)area = *tree[i].ob_spec.userblk;
+ new_tree[i].ob_spec.userblk = (USERBLK *)area;
+ area += sizeof(USERBLK);
+
+ break;
+
+ case G_BUTTON:
+ case G_STRING:
+ case G_TITLE:
+
+ /* Copy the string */
+ size = strlen(tree[i].ob_spec.free_string) + 1L;
+ strcpy(area, tree[i].ob_spec.free_string);
+ new_tree[i].ob_spec.free_string = area;
+ area += size;
+
+ break;
+
+ case G_ICON:
+
+ /* Copy the contents of the ICONBLK-structure */
+ *(ICONBLK *)area = *tree[i].ob_spec.iconblk;
+ new_tree[i].ob_spec.iconblk = (ICONBLK *)area;
+ area += sizeof(ICONBLK);
+
+ size = (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon *
+ (int32_t)tree[i].ob_spec.iconblk->ib_hicon /
+ 8L);
+ /* Copy the mask-data */
+ memcpy(area, tree[i].ob_spec.iconblk->ib_pmask, size);
+ new_tree[i].ob_spec.iconblk->ib_pmask = (int16_t *)area;
+ area += size;
+
+ /* Copy the icon-data */
+ memcpy(area, tree[i].ob_spec.iconblk->ib_pdata, size);
+ new_tree[i].ob_spec.iconblk->ib_pdata = (int16_t *)area;
+ area += size;
+ size = strlen(tree[i].ob_spec.iconblk->ib_ptext) + 1L;
+
+ /* Copy the icon-string */
+ strcpy(area, tree[i].ob_spec.iconblk->ib_ptext);
+ new_tree[i].ob_spec.iconblk->ib_ptext = area;
+ area += size;
+
+ break;
+ }
+
+ /* Assure that area contains an even address */
+ if ((int32_t)area & 1)
+ area++;
+ }
+
+ return(new_tree);
+}
diff --git a/atari/gemtk/utils.c b/atari/gemtk/utils.c
index 1fb67c7..fae9d74 100644
--- a/atari/gemtk/utils.c
+++ b/atari/gemtk/utils.c
@@ -39,7 +39,7 @@ unsigned short _systype (void)
return _systype_v;
}
-bool rc_intersect_ro(GRECT *a, GRECT *b)
+bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b)
{
GRECT r1, r2;
@@ -56,7 +56,7 @@ typedef struct {
char *capslock;
} KEYTAB;
-int keybd2ascii( int keybd, int shift)
+int gemtk_keybd2ascii( int keybd, int shift)
{
KEYTAB *key;
diff --git a/atari/gui.c b/atari/gui.c
index fa56823..a59caa8 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -81,7 +81,6 @@ struct gui_window *window_list = NULL;
void * h_gem_rsrc;
long next_poll;
bool rendering = false;
-bool gui_poll_repeat = false;
GRECT desk_area;
@@ -117,81 +116,68 @@ short aes_msg_out[8];
void gui_poll(bool active)
{
+ struct gui_window *tmp;
short mx, my, dummy;
- unsigned short nkc = 0;
-
- gui_poll_repeat = false;
+ unsigned short nkc = 0;
aes_event_in.emi_tlow = schedule_run();
- if(active || rendering)
- aes_event_in.emi_tlow = 0;
+ if(active || rendering)
+ aes_event_in.emi_tlow = 0;
- if(aes_event_in.emi_tlow < 0){
- aes_event_in.emi_tlow = 10000;
- printf("long poll!\n");
- }
+ if(aes_event_in.emi_tlow < 0) {
+ aes_event_in.emi_tlow = 10000;
+ printf("long poll!\n");
+ }
struct gui_window * g;
if( !active ) {
- if(input_window && input_window->root->redraw_slots.areas_used > 0){
- window_process_redraws(input_window->root);
- }
- /* this suits for stuff with lower priority */
- /* TBD: really be spare on redraws??? */
- hotlist_redraw();
- global_history_redraw();
+ if(input_window && input_window->root->redraw_slots.areas_used >
0) {
+ window_process_redraws(input_window->root);
+ }
}
- // Handle events until there are no more messages pending or
- // until the engine indicates activity:
- bool skip = false;
-/*
- if (active || rendering){
- if ((clock() < next_poll)){
- skip = true;
- } else {
- next_poll = clock() + (CLOCKS_PER_SEC>>5);
- }
- }
-*/
- //if (skip == false) {
- do {
- short mx, my, dummy;
-
- graf_mkstate(&mx, &my, &dummy, &dummy);
- aes_event_in.emi_m1.g_x = mx;
- aes_event_in.emi_m1.g_y = my;
- evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
- if(!guiwin_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
- if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
- LOG(("WM: %d\n", aes_msg_out[0]));
- switch(aes_msg_out[0]) {
-
- case MN_SELECTED:
- LOG(("Menu Item: %d\n",aes_msg_out[4]));
- deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
- break;
- default:
- break;
- }
- }
- if((aes_event_out.emo_events & MU_KEYBD) != 0) {
- uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
- (short)aes_event_out.emo_kreturn);
- deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
- aes_event_out.emo_kmeta, nkc);
- }
- }
- } while ( gui_poll_repeat && !(active||rendering));
- if(input_window && input_window->root->redraw_slots.areas_used > 0){
- window_process_redraws(input_window->root);
+ graf_mkstate(&mx, &my, &dummy, &dummy);
+ aes_event_in.emi_m1.g_x = mx;
+ aes_event_in.emi_m1.g_y = my;
+ evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
+ if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
+ if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
+ LOG(("WM: %d\n", aes_msg_out[0]));
+ switch(aes_msg_out[0]) {
+
+ case MN_SELECTED:
+ LOG(("Menu Item: %d\n",aes_msg_out[4]));
+ deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
+ break;
+ default:
+ break;
+ }
+ }
+ if((aes_event_out.emo_events & MU_KEYBD) != 0) {
+ uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
+ (short)aes_event_out.emo_kreturn);
+ deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
+ aes_event_out.emo_kmeta, nkc);
+ }
+ }
+
+ tmp = window_list;
+ while(tmp){
+ if(tmp->root->redraw_slots.areas_used > 0){
+ window_process_redraws(tmp->root);
}
- //} else {
- //printf("skip poll %d (%d)\n", next_poll, clock());
- //}
+ tmp = tmp->next;
+ }
+ if(hl.tv->redraw){
+ atari_treeview_redraw(hl.tv);
+ }
+
+ if(gl_history.tv->redraw){
+ atari_treeview_redraw(gl_history.tv);
+ }
}
@@ -248,11 +234,11 @@ void gui_window_destroy(struct gui_window *w)
LOG(("%s\n", __FUNCTION__ ));
- if (input_window == w) {
- gui_set_input_gui_window(NULL);
+ if (input_window == w) {
+ gui_set_input_gui_window(NULL);
}
- nsatari_search_session_destroy(w->search);
+ nsatari_search_session_destroy(w->search);
free(w->browser);
free(w->status);
free(w->title);
@@ -273,11 +259,11 @@ void gui_window_destroy(struct gui_window *w)
free(w);
w = NULL;
- if(input_window == NULL){
+ if(input_window == NULL) {
w = window_list;
while( w != NULL ) {
if(w->root) {
- gui_set_input_gui_window(w);
+ gui_set_input_gui_window(w);
break;
}
w = w->next;
@@ -307,7 +293,7 @@ void gui_window_set_title(struct gui_window *gw, const char *title)
int l;
char * conv;
l = strlen(title)+1;
- if (utf8_to_local_encoding(title, l, &conv) == UTF8_CONVERT_OK ) {
+ if (utf8_to_local_encoding(title, l-1, &conv) == UTF8_CONVERT_OK ) {
l = MIN((uint32_t)atari_sysinfo.aes_max_win_title_len, strlen(conv));
if(gw->title == NULL)
gw->title = malloc(l);
@@ -367,17 +353,17 @@ void gui_window_redraw_window(struct gui_window *gw)
void gui_window_update_box(struct gui_window *gw, const struct rect *rect)
{
- GRECT area;
- struct guiwin_scroll_info_s *slid;
+ GRECT area;
+ struct gemtk_wm_scroll_info_s *slid;
if (gw == NULL)
return;
- slid = guiwin_get_scroll_info(gw->root->win);
+ slid = gemtk_wm_get_scroll_info(gw->root->win);
window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
- area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
- area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
+ area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
+ area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
area.g_w = rect->x1 - rect->x0;
area.g_h = rect->y1 - rect->y0;
//dbg_grect("update box", &area);
@@ -386,11 +372,11 @@ void gui_window_update_box(struct gui_window *gw, const struct rect
*rect)
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
{
- int x,y;
+ int x,y;
if (w == NULL)
return false;
- window_get_scroll(w->root, sx, sy);
+ window_get_scroll(w->root, sx, sy);
return( true );
}
@@ -399,12 +385,12 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
{
int units = 0;
if ((w == NULL)
- || (w->browser->bw == NULL)
- || (w->browser->bw->current_content == NULL))
- return;
+ || (w->browser->bw == NULL)
+ || (w->browser->bw->current_content == NULL))
+ return;
- //printf("scroll %d, %d\n", sx, sy);
- window_scroll_by(w->root, sx, sy);
+ LOG(("scroll (gui_window: %p) %d, %d\n", w, sx, sy));
+ window_scroll_by(w->root, sx, sy);
return;
}
@@ -412,9 +398,7 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1)
{
LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1));
- printf("scroll visible\n");
gui_window_set_scroll(w,x0,y0);
- //browser_schedule_redraw_rect( w, 0, 0, x1-x0,y1-y0);
}
@@ -427,11 +411,11 @@ void gui_window_update_extent(struct gui_window *gw)
if( gw->browser->bw->current_content != NULL ) {
// TODO: store content size!
- if(window_get_active_gui_window(gw->root) == gw){
+ if(window_get_active_gui_window(gw->root) == gw) {
window_set_content_size( gw->root,
-
content_get_width(gw->browser->bw->current_content),
-
content_get_height(gw->browser->bw->current_content)
- );
+
content_get_width(gw->browser->bw->current_content),
+
content_get_height(gw->browser->bw->current_content)
+ );
window_update_back_forward(gw->root);
GRECT area;
window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
@@ -549,7 +533,7 @@ void gui_window_set_url(struct gui_window *w, const char *url)
}
strncpy(w->url, url, l);
w->url[l] = 0;
- if(input_window == w->root->active_gui_window){
+ if(input_window == w->root->active_gui_window) {
toolbar_set_url(w->root->toolbar, url);
}
}
@@ -599,8 +583,8 @@ void gui_window_stop_throbber(struct gui_window *w)
/* Place caret in window */
void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
{
- window_place_caret(w->root, 1, x, y, height, NULL);
- w->root->caret.state |= CARET_STATE_ENABLED;
+ window_place_caret(w->root, 1, x, y, height, NULL);
+ w->root->caret.state |= CARET_STATE_ENABLED;
return;
}
@@ -614,11 +598,11 @@ gui_window_remove_caret(struct gui_window *w)
if (w == NULL)
return;
- if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) {
- //printf("gw hide caret\n");
- window_place_caret(w->root, 0, -1, -1, -1, NULL);
- w->root->caret.state &= ~CARET_STATE_ENABLED;
- }
+ if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) {
+ //printf("gw hide caret\n");
+ window_place_caret(w->root, 0, -1, -1, -1, NULL);
+ w->root->caret.state &= ~CARET_STATE_ENABLED;
+ }
return;
}
@@ -629,7 +613,7 @@ gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL;
g->icon = bmp_icon;
- if(input_window == g){
+ if(input_window == g) {
window_set_icon(g->root, bmp_icon);
}
}
@@ -642,10 +626,10 @@ gui_window_set_search_ico(hlcache_handle *ico)
void gui_window_new_content(struct gui_window *w)
{
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(w->root->win);
- slid->x_pos = 0;
- slid->y_pos = 0;
- guiwin_update_slider(w->root->win, GUIWIN_VH_SLIDER);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
+ slid->x_pos = 0;
+ slid->y_pos = 0;
+ gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER);
gui_window_redraw_window(w);
}
@@ -696,37 +680,36 @@ void gui_start_selection(struct gui_window *w)
*/
void gui_get_clipboard(char **buffer, size_t *length)
{
- char *clip;
- size_t clip_len;
+ char *clip;
+ size_t clip_len;
- *length = 0;
- *buffer = 0;
+ *length = 0;
+ *buffer = 0;
- clip = scrap_txt_read();
+ clip = scrap_txt_read();
- if(clip == NULL){
- return;
- } else {
+ if(clip == NULL) {
+ return;
+ } else {
- // clipboard is in atari encoding, convert it to utf8:
+ // clipboard is in atari encoding, convert it to utf8:
- char *utf8 = NULL;
- utf8_convert_ret ret;
+ char *utf8 = NULL;
+ utf8_convert_ret ret;
- clip_len = strlen(clip);
- if (clip_len > 0) {
- ret = utf8_to_local_encoding(clip, clip_len, &utf8);
- if (ret == UTF8_CONVERT_OK && utf8 != NULL) {
- *buffer = utf8;
- *length = strlen(utf8);
- }
- else {
- assert(ret == UTF8_CONVERT_OK && utf8 != NULL);
- }
- }
+ clip_len = strlen(clip);
+ if (clip_len > 0) {
+ ret = utf8_to_local_encoding(clip, clip_len, &utf8);
+ if (ret == UTF8_CONVERT_OK && utf8 != NULL) {
+ *buffer = utf8;
+ *length = strlen(utf8);
+ } else {
+ assert(ret == UTF8_CONVERT_OK && utf8 != NULL);
+ }
+ }
- free(clip);
- }
+ free(clip);
+ }
}
/**
@@ -738,23 +721,23 @@ void gui_get_clipboard(char **buffer, size_t *length)
* \param n_styles Number of text run styles in array
*/
void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
+ nsclipboard_styles styles[], int n_styles)
{
- if (length > 0 && buffer != NULL) {
+ if (length > 0 && buffer != NULL) {
- // convert utf8 input to atari encoding:
+ // convert utf8 input to atari encoding:
- utf8_convert_ret ret;
- char *clip = NULL;
+ utf8_convert_ret ret;
+ char *clip = NULL;
- ret = utf8_to_local_encoding(buffer,length, &clip);
- if (ret == UTF8_CONVERT_OK) {
- scrap_txt_write(clip);
- } else {
- assert(ret == UTF8_CONVERT_OK);
- }
- free(clip);
- }
+ ret = utf8_to_local_encoding(buffer,length, &clip);
+ if (ret == UTF8_CONVERT_OK) {
+ scrap_txt_write(clip);
+ } else {
+ assert(ret == UTF8_CONVERT_OK);
+ }
+ free(clip);
+ }
}
@@ -787,7 +770,7 @@ void gui_401login_open(nsurl *url, const char *realm,
free( out );
}
if (cb != NULL) {
- cb(bres, cbpw);
+ cb(bres, cbpw);
}
}
@@ -810,8 +793,8 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
void gui_set_input_gui_window(struct gui_window *gw)
{
- LOG(("Setting input window from: %p to %p\n", input_window, gw));
- input_window = gw;
+ LOG(("Setting input window from: %p to %p\n", input_window, gw));
+ input_window = gw;
}
void gui_quit(void)
@@ -835,7 +818,7 @@ void gui_quit(void)
urldb_save(nsoption_charp(url_file));
deskmenu_destroy();
- guiwin_exit();
+ gemtk_wm_exit();
rsrc_free();
@@ -863,7 +846,7 @@ process_cmdline(int argc, char** argv)
option_window_y = nsoption_int(window_y);
if (option_window_width <= desk_area.g_w
- && option_window_height < desk_area.g_h) {
+ && option_window_height < desk_area.g_h) {
set_default_dimensions = false;
}
}
@@ -962,7 +945,7 @@ static void gui_init(int argc, char** argv)
die("Uable to open GEM Resource file!");
}
- wind_get_grect(0, WF_WORKXYWH, &desk_area);
+ wind_get_grect(0, WF_WORKXYWH, &desk_area);
create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam );
@@ -972,7 +955,7 @@ static void gui_init(int argc, char** argv)
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
- cursors = get_tree(CURSOR);
+ cursors = gemtk_obj_get_tree(CURSOR);
create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
cursors, &gem_cursors.appstarting);
gem_set_cursor( &gem_cursors.appstarting );
@@ -1005,19 +988,19 @@ static void gui_init(int argc, char** argv)
if (process_cmdline(argc,argv) != true)
die("unable to process command line.\n");
- LOG(("Initializing NKC..."));
+ LOG(("Initializing NKC..."));
nkc_init();
- LOG(("Initializing plotters..."));
+ LOG(("Initializing plotters..."));
plot_init(nsoption_charp(atari_font_driver));
tree_set_icon_dir(nsoption_charp(tree_icons_path));
- aes_event_in.emi_m1leave = MO_LEAVE;
- aes_event_in.emi_m1.g_w = 1;
- aes_event_in.emi_m1.g_h = 1;
- //next_poll = clock() + (CLOCKS_PER_SEC>>3);
+ aes_event_in.emi_m1leave = MO_LEAVE;
+ aes_event_in.emi_m1.g_w = 1;
+ aes_event_in.emi_m1.g_h = 1;
+ //next_poll = clock() + (CLOCKS_PER_SEC>>3);
}
static char *theapp = (char*)"NetSurf";
@@ -1028,7 +1011,7 @@ static void gui_init2(int argc, char** argv)
if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
menu_register( _AESapid, (char*)" NetSurf ");
}
- guiwin_init();
+ gemtk_wm_init();
global_history_init();
hotlist_init();
toolbar_init();
@@ -1072,7 +1055,7 @@ int main(int argc, char** argv)
graf_mouse( ARROW , NULL);
- LOG(("Creating initial browser window..."));
+ LOG(("Creating initial browser window..."));
browser_window_create(option_homepage_url, 0, 0, true, false);
LOG(("Entering NetSurf mainloop..."));
@@ -1084,7 +1067,7 @@ int main(int argc, char** argv)
fclose(stdout);
fclose(stderr);
#endif
- exit_gem();
+ exit_gem();
return 0;
}
diff --git a/atari/gui.h b/atari/gui.h
index c114384..fef686a 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -75,6 +75,7 @@ struct s_gem_cursors {
enum focus_element_type {
WIDGET_NONE=0,
URL_WIDGET,
+ SEARCH_INPUT,
BROWSER
};
diff --git a/atari/history.c b/atari/history.c
index 77df2c9..aa32cbf 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -63,18 +63,18 @@ void global_history_open( void )
pos.g_w = desk_area.g_w / 4;
pos.g_h = desk_area.g_h;
- wind_open(guiwin_get_handle(gl_history.window), pos.g_x, pos.g_y,
+ wind_open(gemtk_wm_get_handle(gl_history.window), pos.g_x, pos.g_y,
pos.g_w, pos.g_h);
gl_history.open = true;
atari_treeview_open(gl_history.tv);
} else {
- wind_set(guiwin_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
+ wind_set(gemtk_wm_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
}
}
void global_history_close( void )
{
- wind_close(guiwin_get_handle(gl_history.window));
+ wind_close(gemtk_wm_get_handle(gl_history.window));
gl_history.open = false;
atari_treeview_close(gl_history.tv);
}
@@ -83,7 +83,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
{
NSTREEVIEW tv=NULL;
- printf("Hotlist event %d, open: %d\n", ev_out->emo_events,
gl_history.open);
+ //printf("Hotlist event %d, open: %d\n", ev_out->emo_events,
gl_history.open);
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
@@ -111,7 +111,7 @@ bool global_history_init( void )
gl_history.open = false;
handle = wind_create(flags, 40, 40, desk_area.g_w, desk_area.g_h);
- gl_history.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ gl_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
if( gl_history.window == NULL ) {
LOG(("Failed to allocate history window"));
return( false );
@@ -121,6 +121,8 @@ bool global_history_init( void )
gl_history.tv = atari_treeview_create(history_global_get_tree_flags(),
gl_history.window, handle_event);
+ gemtk_wm_unlink(gl_history.window);
+
if (gl_history.tv == NULL) {
/* TODO: handle it properly, clean up previous allocs */
LOG(("Failed to allocate history treeview"));
@@ -144,8 +146,8 @@ void global_history_destroy( void )
history_global_cleanup();
if( gl_history.open )
global_history_close();
- wind_delete(guiwin_get_handle(gl_history.window));
- guiwin_remove(gl_history.window);
+ wind_delete(gemtk_wm_get_handle(gl_history.window));
+ gemtk_wm_remove(gl_history.window);
gl_history.window = NULL;
atari_treeview_destroy(gl_history.tv);
gl_history.init = false;
diff --git a/atari/hotlist.c b/atari/hotlist.c
index ccba088..3684a9a 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -61,7 +61,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case WM_TOOLBAR:
- tv = (NSTREEVIEW) guiwin_get_user_data(win);
+ tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
@@ -74,7 +74,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_delete_selected();
- guiwin_send_redraw(tv->window, NULL);
+ gemtk_wm_send_redraw(tv->window, NULL);
break;
case TOOLBAR_HOTLIST_EDIT:
@@ -82,14 +82,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
break;
}
- get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
- guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, &tb_area);
+ gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area);
evnt_timer(150);
- guiwin_send_redraw(tv->window, &tb_area);
+ gemtk_wm_send_redraw(tv->window, &tb_area);
break;
case WM_CLOSED:
- hotlist_destroy();
+ hotlist_close();
break;
default: break;
@@ -117,18 +117,19 @@ void hotlist_init(void)
int flags = ATARI_TREEVIEW_WIDGETS;
short handle = -1;
GRECT desk;
- OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
+ OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
assert( tree );
hl.open = false;
handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h);
- hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ hl.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL);
if( hl.window == NULL ) {
LOG(("Failed to allocate Hotlist"));
return;
}
wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist"));
- guiwin_set_toolbar(hl.window, tree, 0, 0);
+ gemtk_wm_set_toolbar(hl.window, tree, 0, 0);
+ gemtk_wm_unlink(hl.window);
hl.tv = atari_treeview_create(
hotlist_get_tree_flags(),
hl.window,
@@ -169,19 +170,19 @@ void hotlist_open(void)
pos.g_w = desk_area.g_w / 4;
pos.g_h = desk_area.g_h;
- wind_open_grect(guiwin_get_handle(hl.window), &pos);
+ wind_open_grect(gemtk_wm_get_handle(hl.window), &pos);
hl.open = true;
atari_treeview_open( hl.tv );
} else {
- wind_set(guiwin_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
+ wind_set(gemtk_wm_get_handle(hl.window), WF_TOP, 1, 0, 0, 0);
}
}
void hotlist_close(void)
{
- wind_close(guiwin_get_handle(hl.window));
+ wind_close(gemtk_wm_get_handle(hl.window));
hl.open = false;
- atari_treeview_close( hl.tv );
+ atari_treeview_close(hl.tv);
}
void hotlist_destroy(void)
@@ -194,10 +195,10 @@ void hotlist_destroy(void)
hotlist_cleanup( (char*)&hl.path );
if (hl.open)
hotlist_close();
- wind_delete(guiwin_get_handle(hl.window));
- guiwin_remove(hl.window);
+ wind_delete(gemtk_wm_get_handle(hl.window));
+ gemtk_wm_remove(hl.window);
hl.window = NULL;
- atari_treeview_destroy( hl.tv );
+ atari_treeview_destroy(hl.tv);
hl.init = false;
}
LOG(("done"));
diff --git a/atari/login.c b/atari/login.c
index 0fad4cd..461a2f9 100755
--- a/atari/login.c
+++ b/atari/login.c
@@ -54,7 +54,7 @@ bool login_form_do(nsurl * url, char * realm, char ** out)
// TODO: use auth details for predefined login data
// auth = urldb_get_auth_details(url, realm);
- tree = get_tree(LOGIN);
+ tree = gemtk_obj_get_tree(LOGIN);
assert(tree != NULL);
diff --git a/atari/misc.c b/atari/misc.c
index d339379..1b4c3ea 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -61,13 +61,13 @@ void warn_user(const char *warning, const char *detail)
snprintf(message, len, messages_get(warning), detail);
printf("%s\n", message);
- msg_box_show(MSG_BOX_ALERT, message);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, message);
}
void die(const char *error)
{
printf("%s\n", error);
- msg_box_show(MSG_BOX_ALERT, error);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, error);
exit(1);
}
@@ -123,7 +123,7 @@ struct gui_window * find_guiwin_by_aes_handle(short handle){
while(gw != NULL) {
if( gw->root->win != NULL
- && guiwin_get_handle(gw->root->win) == handle ) {
+ && gemtk_wm_get_handle(gw->root->win) == handle ) {
return(gw);
}
else
@@ -323,7 +323,7 @@ void gem_set_cursor( MFORM_EX * cursor )
if( flags == cursor->flags && number == cursor->number )
return;
if( cursor->flags & MFORM_EX_FLAG_USERFORM ) {
- obj_mouse_sprite(cursor->tree, cursor->number);
+ gemtk_obj_mouse_sprite(cursor->tree, cursor->number);
} else {
graf_mouse(cursor->number, NULL );
}
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 2339cd6..8db7cc2 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -607,9 +607,10 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&c, (unsigned short*)&out );
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0]);
+ RGB1000 out;
+ rgb_to_vdi1000( (unsigned char*)&c, &out);
+ vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR,
+ (unsigned short*)&out);
#ifdef WITH_8BPP_SUPPORT
} else {
c = RGB_TO_VDI(c);
diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c
index 6e6e330..3db29eb 100644
--- a/atari/plot/font_internal.c
+++ b/atari/plot/font_internal.c
@@ -245,10 +245,18 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out
);
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
- plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
+ //unsigned short out[4];
+ RGB1000 out;
+ //rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned
short*)&out );
+ out.blue = 0;
+ out.green = 1000;
+ out.red = 0;
+ vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (short *)&out);
+ vq_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, 1, (short *)&out);
+ //printf("r:%d,g:%d,b:%d", out.red, out.green, out.blue);
+ //vsl_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR);
+ //vsf_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR);
+ plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS);
#ifdef WITH_8BPP_SUPPORT
} else {
unsigned char c = RGB_TO_VDI(fstyle->foreground);
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 89596b3..4ebab24 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -16,15 +16,20 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#ifdef WITH_VDI_FONT_DRIVER
+#ifdef WITH_VDI_FONT_DRIVER
+
+#include <mt_gemx.h>
+
#include "atari/plot/plot.h"
#include "atari/plot/font_vdi.h"
#include "utils/utf8.h"
-#include "utils/log.h"
+#include "utils/log.h"
+
-static char * lstr = NULL;
+
+//static char * lstr = NULL;
static int dtor( FONT_PLOTTER self );
@@ -39,6 +44,25 @@ static bool init = false;
static int vdih;
extern struct s_vdi_sysinfo vdi_sysinfo;
+
+static inline void atari_to_vdi_str(char *lstr, int length)
+{
+ int i, z;
+
+ for (i=z=0; i<length; ) {
+ if (((char)lstr[i]==(char)0xC2) && ((char)lstr[i+1] == (char)0xA0)) {
+ lstr[z] = ' ';
+ lstr[z+1] = ' ';
+ i=i+2;
+ z=z+2;
+ }
+ else {
+ lstr[z] = lstr[i];
+ i++;
+ z++;
+ }
+ }
+}
int ctor_font_plotter_vdi( FONT_PLOTTER self )
{
@@ -65,11 +89,15 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t
*fstyle, const c
{
short cw, ch, cellw, cellh;
short pxsize;
- short fx=0;
- lstr = (char*)str;
- utf8_to_enc(str, "ATARIST", length, &lstr );
+ short fx=0;
+ char * lstr = NULL;
+
+ utf8_to_local_encoding(str, length, &lstr);
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr);
+
+
+ atari_to_vdi_str(lstr, slen);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -79,11 +107,19 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t
*fstyle, const c
fx |= 1;
vst_effects( self->vdi_handle, fx );
/* TODO: replace 90 with global dpi setting */
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+/*
+ if(slen != utf8_bounded_length(str, length)){
+ printf("sl: %d, utl: %d\n ", slen, utf8_bounded_length(str, length));
+ printf("s: %s // %s\n", str, lstr );
+ }*/
+
+
*width = slen * cellw;
- free( (void*)lstr );
- lstr = NULL;
+ free((void*)lstr);
return( 0 );
}
@@ -94,15 +130,19 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *
fstyle, const
short pxsize;
short fx=0;
int i;
- lstr = (char*)string;
- int slen = 0;
+ char *lstr = NULL;
+ size_t slen = 0;
int last_space_x = 0;
- int last_space_idx = 0;
+ int last_space_idx = 0;
+ size_t nxtchr = 0;
- utf8_to_enc(string, "ATARIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
+ slen = strlen(lstr);
+
+
+ atari_to_vdi_str(lstr, slen);
- slen = strlen(lstr);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
@@ -110,27 +150,50 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *
fstyle, const
if( fstyle->weight > 450 )
fx |= 1;
vst_effects( self->vdi_handle, fx );
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+
+ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
*actual_x = 0;
- *char_offset = 0;
- int cpos=0;
- for( i=0; i<slen; i++) {
- if( lstr[i] == ' ' ) {
+ //*char_offset = 0;
+ int cpos=0;
+ while (nxtchr < slen) {
+ if( lstr[nxtchr] == ' ' ) {
last_space_x = *actual_x;
- last_space_idx = cpos;
- }
- if( *actual_x > x ) {
- *actual_x = last_space_x;
- *char_offset = last_space_idx;
- return true;
- }
- *actual_x += cellw;
- cpos++;
- }
- *char_offset = cpos;
+ last_space_idx = nxtchr;
+ }
+ *actual_x += cellw;
+ if (*actual_x > x) {
+ *actual_x = last_space_x;
+ *char_offset = last_space_idx;
+ //printf("at: %s\n", lstr);
+ return(0);
+ }
+
+ nxtchr++;
+ }
+ if(nxtchr >= length){
+ nxtchr = length-1;
+ }
+
+ *char_offset = nxtchr;
+
+// for( i=0; i<slen; i++) {
+// if( lstr[i] == ' ' ) {
+// last_space_x = *actual_x;
+// last_space_idx = cpos;
+// }
+// if( *actual_x > x ) {
+// *actual_x = last_space_x;
+// *char_offset = last_space_idx;
+// return true;
+// }
+// *actual_x += cellw;
+// cpos++;
+// }
+// *char_offset = cpos;
free( (void*)lstr );
- lstr = NULL;
return( 0 );
}
@@ -141,19 +204,22 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *
fstyle,const
short pxsize=0;
short fx=0;
- lstr = (char*)string;
+ char *lstr = NULL;
int i=0;
int curpx=0;
- utf8_to_enc(string, "ATRIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr);
+
+ atari_to_vdi_str(lstr, slen);
+
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
- vst_effects( self->vdi_handle, fx );
+ vst_effects(self->vdi_handle, fx);
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
*actual_x = 0;
@@ -166,24 +232,30 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *
fstyle,const
break;
}
}
- free( (void*)lstr );
+ free((void*)lstr);
lstr = NULL;
return( 0 );
}
static inline void vst_rgbcolor( short vdih, uint32_t cin )
{
- if( vdi_sysinfo.scr_bpp > 8 ) {
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
- vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] );
+#ifdef WITH_8BPP_SUPPORT
+ if( vdi_sysinfo.scr_bpp > 8 ) {
+#endif
+ //unsigned short c[4];
+ RGB1000 c;
+
+ rgb_to_vdi1000( (unsigned char*)&cin, &c );
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vst_color( vdih, OFFSET_CUSTOM_COLOR );
+#ifdef WITH_8BPP_SUPPORT
} else {
if( vdi_sysinfo.scr_bpp >= 4 )
vst_color( vdih, RGB_TO_VDI(cin) );
else
vst_color( vdih, BLACK );
- }
+ }
+#endif
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
@@ -192,16 +264,20 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
/* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */
short cw, ch, cellw, cellh;
short pxsize=8;
- short fx=0;
- lstr = (char*)text;
- utf8_to_enc(text, "ATARIST", length, &lstr );
- assert( lstr != NULL );
- int slen = strlen(lstr);
- size_t mylen = MIN(511, slen );
- char textcpy[mylen+1];
+ short fx=0;
+ GRECT canvas;
+ char *lstr = NULL;
+ assert( utf8_to_local_encoding(text, length, &lstr) == UTF8_CONVERT_OK);
+ assert( lstr != NULL );
+
+ int slen = strlen(lstr);
+ if(slen > 800){
+ lstr[800]=0;
+ }
+
+
+ atari_to_vdi_str(lstr, slen);
- textcpy[mylen] = 0;
- strncpy((char*)&textcpy, lstr, mylen+1 );
if( fstyle != NULL){
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -212,20 +288,25 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text,
size_t leng
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss),
use that value or pass it as arg, to reduce netsurf dependency */
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- }
- x += CURFB(self->plotter).x;
- y += CURFB(self->plotter).y;
+ }
+ plot_get_dimensions(&canvas);
+ x += canvas.g_x;
+ y += canvas.g_y;
vst_effects( self->vdi_handle, fx );
- vst_alignment(vdih, 0, 4, &cw, &ch );
- vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ vst_alignment(vdih, 0, 0, &cw, &ch );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ //vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
vswr_mode( self->vdi_handle, MD_TRANS );
- vst_rgbcolor(self->vdi_handle, fstyle->foreground );
+ vst_rgbcolor(self->vdi_handle, fstyle->foreground);
- if( atari_sysinfo.gdos_FSMC ){
- v_ftext( self->vdi_handle, x, y, (char*)&textcpy );
- } else {
- v_gtext( self->vdi_handle, x, y, (char*)&textcpy );
+ if( atari_sysinfo.gdos_FSMC ){
+ //printf("\nftext\n");
+ v_ftext( self->vdi_handle, x, y, (char*)lstr );
+ } else {
+ //printf("\ngtext\n");
+ v_gtext( self->vdi_handle, x, y, (char*)lstr );
}
free( lstr );
return( 0 );
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index eb44e47..2a8fd68 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -193,9 +193,10 @@ inline static void vsl_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c);
- vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0]);
+ //unsigned short c[4];
+ RGB1000 c;
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vsl_color(vdih, OFFSET_CUSTOM_COLOR);
#ifdef WITH_8BPP_SUPPORT
} else {
@@ -219,9 +220,9 @@ inline static void vsf_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
- vs_color( vdih, OFFSET_CUSTOM_COLOR, &c[0] );
+ RGB1000 c;
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vsf_color( vdih, OFFSET_CUSTOM_COLOR );
#ifdef WITH_8BPP_SUPPORT
} else {
@@ -512,14 +513,14 @@ static struct s_vdi_sysinfo * read_vdi_sysinfo(short vdih, struct
s_vdi_sysinfo
/*
Convert an RGB color to an VDI Color
*/
-inline void rgb_to_vdi1000(unsigned char * in, unsigned short * out)
+inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out)
{
double r = ((double)in[3]/255); /* prozentsatz red */
double g = ((double)in[2]/255); /* prozentsatz green */
double b = ((double)in[1]/255); /* prozentsatz blue */
- out[0] = 1000 * r + 0.5;
- out[1] = 1000 * g + 0.5;
- out[2] = 1000 * b + 0.5;
+ out->red = 1000 * r + 0.5;
+ out->green = 1000 * g + 0.5;
+ out->blue = 1000 * b + 0.5;
return;
}
@@ -1441,14 +1442,14 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
return(true);
}
-bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor,
+bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
uint32_t flags)
{
MFDB screen, tran;
MFDB * src;
short pxy[8];
- short c[2] = {fgcolor, G_WHITE};
+ short c[2] = {fgcolor, 0};
GRECT off;
plot_get_clip_grect(&off);
@@ -1457,29 +1458,30 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char
fgcolor,
}
init_mfdb( 0, loc->g_w, loc->g_h, 0, &screen );
-
- if( insrc->fd_stand ){
- int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h,
- MFDB_FLAG_NOALLOC,
- &tran
- );
- if( size_buf_scr == 0 ){
- buf_scr.fd_addr = malloc( size );
- size_buf_scr = size;
- } else {
- if( size > size_buf_scr ) {
- buf_scr.fd_addr = realloc(
- buf_scr.fd_addr, size
- );
- size_buf_scr = size;
- }
- }
- tran.fd_addr = buf_scr.fd_addr;
- vr_trnfm(atari_plot_vdi_handle, insrc, &tran );
- src = &tran;
- } else {
+//
+// if( insrc->fd_stand){
+// printf("st\n");
+// int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h,
+// MFDB_FLAG_NOALLOC,
+// &tran
+// );
+// if( size_buf_scr == 0 ){
+// buf_scr.fd_addr = malloc( size );
+// size_buf_scr = size;
+// } else {
+// if( size > size_buf_scr ) {
+// buf_scr.fd_addr = realloc(
+// buf_scr.fd_addr, size
+// );
+// size_buf_scr = size;
+// }
+// }
+// tran.fd_addr = buf_scr.fd_addr;
+// vr_trnfm(atari_plot_vdi_handle, insrc, &tran );
+// src = &tran;
+// } else {
src = insrc;
- }
+// }
pxy[0] = off.g_x - loc->g_x;
pxy[1] = off.g_y - loc->g_y;
@@ -1492,7 +1494,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char
fgcolor,
if( flags & PLOT_FLAG_TRANS && src->fd_nplanes == 1){
- vrt_cpyfm(atari_plot_vdi_handle, MD_TRANS, (short*)pxy, src, &screen,
(short*)&c );
+ vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen,
(short*)&c);
} else {
/* this method only plots transparent bitmaps, right now... */
}
diff --git a/atari/plot/plot.h b/atari/plot/plot.h
index df34be4..b0ec58b 100755
--- a/atari/plot/plot.h
+++ b/atari/plot/plot.h
@@ -115,7 +115,7 @@ bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t
*style );
bool plot_line( int x0, int y0, int x1, int y1, const plot_style_t *style );
bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags);
-bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor,
+bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
uint32_t flags);
bool plot_copy_rect(GRECT src, GRECT dst);
@@ -123,7 +123,7 @@ bool plot_copy_rect(GRECT src, GRECT dst);
void vdi1000_to_rgb( unsigned short * in, unsigned char * out );
/* convert an bgra color to vdi1000 color */
-void rgb_to_vdi1000( unsigned char * in, unsigned short * out );
+void rgb_to_vdi1000( unsigned char * in, RGB1000 *out);
/* convert an rgb color to an index into the web palette */
short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b);
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index 3ccd22d..64a8e35 100755
Binary files a/atari/res/netsurf.rsc and b/atari/res/netsurf.rsc differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 7fe6bc9..268aff5 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -56,7 +56,7 @@
#define TOOLBAR_BT_FORWARD 14 /* CICON in tree TOOLBAR */
#define TOOLBAR_BT_STOP 15 /* CICON in tree TOOLBAR */
#define TOOLBAR_BT_RELOAD 16 /* CICON in tree TOOLBAR */
-#define TOOLBAR_AREA_URL 17 /* BOX in tree TOOLBAR */
+#define TOOLBAR_AREA_URL 17 /* USERDEF in tree TOOLBAR */
#define TOOLBAR_THROBBER_AREA 18 /* BOX in tree TOOLBAR */
#define ICONIFY 2 /* form/dial */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 08f9828..189c600 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -3,7 +3,7 @@ ResourceMaster v3.65
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 20010100@0@7728@639@
+#M 20010100@0@7728@640@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -59,7 +59,7 @@ ResourceMaster v3.65
#O 14@33@BT_FORWARD@@
#O 15@33@BT_STOP@@
#O 16@33@BT_RELOAD@@
-#O 17@20@AREA_URL@@
+#O 17@24@AREA_URL@@
#O 18@20@THROBBER_AREA@@
#T 2@2@ICONIFY@@3@@
#O 1@33@GLOBE@@
@@ -196,4 +196,4 @@ ResourceMaster v3.65
#T 15@2@POP_FONT_RENDERER@@3@@
#O 1@28@INTERNAL@@
#O 2@28@FREETYPE@@
-#c 22525@
+#c 22411@
diff --git a/atari/rootwin.c b/atari/rootwin.c
index 5acd417..45f5568 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -96,12 +96,13 @@ static const struct redraw_context rootwin_rdrw_ctx = {
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
- GRECT content_area;
+ GRECT area;
static bool prev_url = false;
static short prev_x=0;
static short prev_y=0;
- struct rootwin_data_s * data = guiwin_get_user_data(win);
+ struct rootwin_data_s * data = gemtk_wm_get_user_data(win);
struct gui_window *tmp;
+ OBJECT *obj;
if ((ev_out->emo_events & MU_MESAG) != 0) {
@@ -127,7 +128,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
tmp = window_list;
while(tmp != NULL){
if(tmp->root != data->rootwin){
- guiwin_send_msg(tmp->root->win, WM_TOPPED, 0, 0, 0, 0);
+ gemtk_wm_send_msg(tmp->root->win, WM_TOPPED, 0, 0, 0, 0);
break;
}
tmp = tmp->next;
@@ -139,7 +140,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
case WM_UNICONIFY:
LOG(("WM_TOPPED"));
gui_set_input_gui_window(data->rootwin->active_gui_window);
- window_restore_active_gui_window(data->rootwin);
+ //window_restore_active_gui_window(data->rootwin);
// TODO: use something like "restore_active_gui_window_state()"
break;
@@ -177,9 +178,9 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
}
if ((ev_out->emo_events & MU_BUTTON) != 0) {
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
- &content_area);
+ &area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
- content_area)) {
+ area)) {
on_content_mouse_click(data->rootwin);
}
}
@@ -191,10 +192,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
// The window found at x,y is an gui_window
// and it's the input window.
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
- &content_area);
+ &area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
- content_area)) {
- on_content_mouse_move(data->rootwin, &content_area);
+ area)) {
+ on_content_mouse_move(data->rootwin, &area);
} else {
GRECT tb_area;
window_get_grect(data->rootwin, BROWSER_AREA_URL_INPUT,
&tb_area);
@@ -230,7 +231,7 @@ int window_create(struct gui_window * gw,
bool tb, sb;
int flags;
struct rootwin_data_s *data;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
tb = (inflags & WIDGET_TOOLBAR);
sb = (inflags & WIDGET_STATUSBAR);
@@ -261,13 +262,13 @@ int window_create(struct gui_window * gw,
free(gw->root);
return( -1 );
}
- gw->root->win = guiwin_add(gw->root->aes_handle,
- GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM,
handle_event);
+ gw->root->win = gemtk_wm_add(gw->root->aes_handle,
+ GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM,
handle_event);
data = malloc(sizeof(struct rootwin_data_s));
data->rootwin = gw->root;
- guiwin_set_user_data(gw->root->win, (void*)data);
- slid = guiwin_get_scroll_info(gw->root->win);
+ gemtk_wm_set_user_data(gw->root->win, (void*)data);
+ slid = gemtk_wm_get_scroll_info(gw->root->win);
slid->y_unit_px = 32;
slid->x_unit_px = 32;
@@ -275,8 +276,8 @@ int window_create(struct gui_window * gw,
if(tb) {
gw->root->toolbar = toolbar_create(gw->root);
assert(gw->root->toolbar);
- guiwin_set_toolbar(gw->root->win, get_tree(TOOLBAR), 0, 0);
- guiwin_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb);
+ gemtk_wm_set_toolbar(gw->root->win, gw->root->toolbar->form, 0,
0);
+ gemtk_wm_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb);
} else {
gw->root->toolbar = NULL;
}
@@ -346,8 +347,8 @@ int window_destroy(ROOTWIN *rootwin)
LOG(("%p", rootwin));
- if (guiwin_get_user_data(rootwin->win) != NULL) {
- free(guiwin_get_user_data(rootwin->win));
+ if (gemtk_wm_get_user_data(rootwin->win) != NULL) {
+ free(gemtk_wm_get_user_data(rootwin->win));
}
// make sure we do not destroy windows which have gui_windows attached:
@@ -368,7 +369,7 @@ int window_destroy(ROOTWIN *rootwin)
if(rootwin->title)
free(rootwin->title);
- guiwin_remove(rootwin->win);
+ gemtk_wm_remove(rootwin->win);
wind_close(rootwin->aes_handle);
wind_delete(rootwin->aes_handle);
free(rootwin);
@@ -391,7 +392,7 @@ void window_open(ROOTWIN *rootwin, struct gui_window *gw, GRECT pos)
if(rootwin->statusbar != NULL) {
sb_attach(rootwin->statusbar, rootwin->active_gui_window);
}
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, &g);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, &g);
toolbar_set_attached(rootwin->toolbar, true);
toolbar_set_dimensions(rootwin->toolbar, &g);
window_update_back_forward(rootwin);
@@ -415,14 +416,11 @@ void window_restore_active_gui_window(ROOTWIN *rootwin)
window_set_title(rootwin, gw->title);
if (gw->search != NULL) {
- nsatari_search_restore_form(gw->search, get_tree(TOOLBAR));
- window_open_search(rootwin, false);
- } else {
- toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
+ // TODO: update search session (especially browser window)
}
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
- guiwin_set_toolbar_size(rootwin->win, tb_area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h);
window_update_back_forward(rootwin);
@@ -461,7 +459,7 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
{
int units;
GRECT content_area;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(root->win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(root->win);
if(sx < 0) {
sx = 0;
@@ -472,9 +470,9 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
int xunits = sx / slid->x_unit_px;
int yunits = sy / slid->y_unit_px;
- guiwin_scroll(root->win, GUIWIN_VSLIDER, yunits - slid->y_pos, false);
- guiwin_scroll(root->win, GUIWIN_HSLIDER, xunits - slid->x_pos, false);
- guiwin_update_slider(root->win, GUIWIN_VH_SLIDER);
+ gemtk_wm_scroll(root->win, GEMTK_WM_VSLIDER, yunits - slid->y_pos, false);
+ gemtk_wm_scroll(root->win, GEMTK_WM_HSLIDER, xunits - slid->x_pos, false);
+ gemtk_wm_update_slider(root->win, GEMTK_WM_VH_SLIDER);
}
/**
@@ -484,7 +482,7 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy)
void window_set_content_size(ROOTWIN *rootwin, int width, int height)
{
GRECT area;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(rootwin->win);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(rootwin->win);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
@@ -494,7 +492,7 @@ void window_set_content_size(ROOTWIN *rootwin, int width, int height)
slid->x_pos = 0;
if(slid->y_units < slid->y_pos)
slid->y_pos = 0;
- guiwin_update_slider(rootwin->win, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(rootwin->win, GEMTK_WM_VH_SLIDER);
}
/* set focus to an arbitary element */
@@ -509,21 +507,26 @@ void window_set_focus(struct s_gui_win_root *rootwin,
LOG(("Set focus: %p (%d)\n", element, type));
rootwin->focus.type = type;
rootwin->focus.element = element;
- if( element != NULL ) {
- switch( type ) {
+ switch( type ) {
- case URL_WIDGET:
+ case URL_WIDGET:
// TODO: make something like: toolbar_text_select_all();
- ta = toolbar_get_textarea(rootwin->toolbar,
- URL_INPUT_TEXT_AREA);
- textarea_keypress(ta, KEY_SELECT_ALL);
- break;
+ toolbar_key_input(rootwin->toolbar, (short)(NKF_CTRL | 'A') );
+/*
+ ta = toolbar_get_textarea(rootwin->toolbar,
+ URL_INPUT_TEXT_AREA);
+ textarea_keypress(ta, KEY_SELECT_ALL);
+ */
+ break;
- default:
- break;
+ case SEARCH_INPUT:
+ gemtk_wm_set_toolbar_edit_obj(rootwin->win, TOOLBAR_TB_SRCH, 0);
+ break;
- }
- }
+ default:
+ break;
+
+ }
}
}
@@ -556,7 +559,7 @@ void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp )
/* redraw window when it is iconyfied: */
if (rootwin->icon != NULL) {
short info, dummy;
- if (guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED) {
+ if (gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
window_redraw_favicon(rootwin, NULL);
}
}
@@ -584,15 +587,16 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct
gui_window *gw)
}
}
-struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin) {
+struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin)
+{
return(rootwin->active_gui_window);
}
void window_get_scroll(ROOTWIN *rootwin, int *x, int *y)
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
*x = slid->x_pos * slid->x_unit_px;
*y = slid->y_pos * slid->y_unit_px;
@@ -607,14 +611,14 @@ void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which,
GRECT *d)
d->g_h = 0;
if (which == BROWSER_AREA_TOOLBAR) {
- // guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, d);
+ // gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, d);
toolbar_get_grect(rootwin->toolbar, 0, d);
} else if (which == BROWSER_AREA_CONTENT) {
GRECT tb_area;
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, d);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, d);
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
d->g_y += tb_area.g_h;
@@ -652,20 +656,12 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
struct gui_window *gw;
GRECT area;
OBJECT *obj;
- static bool init = false;
LOG((""));
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
- obj = get_tree(TOOLBAR);
-
- if (init == false) {
- obj[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
- obj[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
- gemtk_obj_set_str_safe(obj, TOOLBAR_TB_SRCH, (char*)"");
- init = true;
- }
+ obj = toolbar_get_form(rootwin->toolbar);
if (gw->search == NULL) {
gw->search = nsatari_search_session_create(obj, bw);
@@ -673,9 +669,12 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, true);
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area);
- guiwin_set_toolbar_size(rootwin->win, area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
window_get_grect(rootwin, BROWSER_AREA_SEARCH, &area);
window_schedule_redraw_grect(rootwin, &area);
+ window_process_redraws(rootwin);
+ window_set_focus(rootwin, SEARCH_INPUT, NULL);
+
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
if (reformat) {
browser_window_reformat(bw, false, area.g_w, area.g_h);
@@ -692,18 +691,16 @@ void window_close_search(ROOTWIN *rootwin)
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
- obj = get_tree(TOOLBAR);
+ obj = gemtk_obj_get_tree(TOOLBAR);
if (gw->search != NULL) {
nsatari_search_session_destroy(gw->search);
gw->search = NULL;
}
- obj[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED;
-
toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false);
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area);
- guiwin_set_toolbar_size(rootwin->win, area.g_h);
+ gemtk_wm_set_toolbar_size(rootwin->win, area.g_h);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area);
browser_window_reformat(bw, false, area.g_w, area.g_h);
}
@@ -719,8 +716,8 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip)
//printf("window_redraw_favicon: root: %p, win: %p\n", rootwin,
rootwin->win);
- guiwin_clear(rootwin->win);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_clear(rootwin->win);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if (clip == NULL) {
clip = &work;
@@ -732,7 +729,7 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip)
if (rootwin->icon == NULL) {
//printf("window_redraw_favicon OBJCTREE\n");
- OBJECT * tree = get_tree(ICONIFY);
+ OBJECT * tree = gemtk_obj_get_tree(ICONIFY);
tree->ob_x = work.g_x;
tree->ob_y = work.g_y;
tree->ob_width = work.g_w;
@@ -766,7 +763,7 @@ void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
//dbg_grect("window_schedule_redraw_grect input ", area);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if(!rc_intersect(area, &work))
return;
@@ -777,7 +774,7 @@ void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
GRECT *clip,
- struct guiwin_scroll_info_s * slid,
+ struct gemtk_wm_scroll_info_s * slid,
struct browser_window *bw)
{
@@ -834,13 +831,13 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int
content_x,
int content_y, int h, GRECT *work)
{
struct s_caret *caret = &rootwin->caret;
- VdiHdl vh = guiwin_get_vdi_handle(rootwin->win);
+ VdiHdl vh = gemtk_wm_get_vdi_handle(rootwin->win);
short pxy[8];
GRECT mywork, caret_pos;
MFDB screen;
int i, scroll_x, scroll_y;
uint16_t *fd_addr;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
short colors[2] = {G_BLACK, G_WHITE};
bool render_required = false;
@@ -857,7 +854,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &mywork);
work = &mywork;
}
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
scroll_x = slid->x_pos * slid->x_unit_px;
scroll_y = slid->y_pos * slid->y_unit_px;
@@ -965,7 +962,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
exit:
// disable clipping:
- vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy);
+ vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy);
}
void window_process_redraws(ROOTWIN * rootwin)
@@ -975,14 +972,14 @@ void window_process_redraws(ROOTWIN * rootwin)
short scroll_x=0, scroll_y=0;
bool toolbar_rdrw_required;
bool caret_rdrw_required = false;
- struct guiwin_scroll_info_s *slid =NULL;
+ struct gemtk_wm_scroll_info_s *slid =NULL;
int caret_h = 0;
struct s_caret *caret = &rootwin->caret;
redraw_active = true;
toolbar_get_grect(rootwin->toolbar, 0, &tb_area);
- //guiwin_set_toolbar_size(rootwin->win, tb_area.g_h);
+ //gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area);
//dbg_grect("content area", &content_area);
@@ -1001,8 +998,8 @@ void window_process_redraws(ROOTWIN * rootwin)
pxy_clip[0] = tb_area.g_y;
pxy_clip[0] = pxy_clip[0] + tb_area.g_w + content_area.g_w - 1;
pxy_clip[0] = pxy_clip[1] + tb_area.g_h + content_area.g_h - 1;
- vs_clip(guiwin_get_vdi_handle(rootwin->win), 1, pxy_clip);
- //guiwin_clear(rootwin->win);
+ vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 1, pxy_clip);
+ //gemtk_wm_clear(rootwin->win);
*/
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible_ro);
while (visible_ro.g_w > 0 && visible_ro.g_h > 0) {
@@ -1031,7 +1028,7 @@ void window_process_redraws(ROOTWIN * rootwin)
if (rc_intersect(&content_area, &rdrw_area)) {
if(slid == NULL) {
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
scroll_x = slid->x_pos * slid->x_unit_px;
scroll_y = slid->y_pos * slid->y_unit_px;
@@ -1051,7 +1048,7 @@ void window_process_redraws(ROOTWIN * rootwin)
caret_pos.g_w = caret->dimensions.g_w;
caret_pos.g_h = caret->dimensions.g_h;
- if (rc_intersect_ro(&caret_pos, &content_area)) {
+ if (gemtk_rc_intersect_ro(&caret_pos, &content_area)) {
caret_rdrw_required = true;
}
}
@@ -1063,7 +1060,7 @@ void window_process_redraws(ROOTWIN * rootwin)
// disable clipping:
- //vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy_clip);
+ //vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy_clip);
if (caret_rdrw_required && ((rootwin->caret.state &
CARET_STATE_ENABLED)!=0)) {
@@ -1089,7 +1086,7 @@ void window_process_redraws(ROOTWIN * rootwin)
static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area)
{
int mx, my, sx, sy;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
struct gui_window *gw;
struct browser_window *bw;
@@ -1097,7 +1094,7 @@ static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT
*content_area)
mx = aes_event_out.emo_mouse.p_x - content_area->g_x;
my = aes_event_out.emo_mouse.p_y - content_area->g_y;
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
gw = window_get_active_gui_window(rootwin);
bw = gw->browser->bw;
@@ -1114,7 +1111,7 @@ static bool on_content_mouse_click(ROOTWIN *rootwin)
GRECT cwork;
browser_mouse_state bmstate = 0;
struct gui_window *gw;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
gw = window_get_active_gui_window(rootwin);
if(input_window != gw) {
@@ -1147,7 +1144,7 @@ static bool on_content_mouse_click(ROOTWIN *rootwin)
}
/* convert component coords to scrolled content coords: */
- slid = guiwin_get_scroll_info(rootwin->win);
+ slid = gemtk_wm_get_scroll_info(rootwin->win);
int sx_origin = mx;
int sy_origin = my;
@@ -1245,49 +1242,49 @@ static bool on_content_keypress(struct browser_window *bw,
unsigned short nkc)
GUIWIN * w = bw->window->root->win;
window_get_grect(bw->window->root, BROWSER_AREA_CONTENT, &g);
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(w);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w);
switch( ik ) {
case KEY_LINE_START:
- guiwin_scroll(w, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px),
false);
break;
case KEY_LINE_END:
- guiwin_scroll(w, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px),
false);
break;
case KEY_PAGE_UP:
- guiwin_scroll(w, GUIWIN_VSLIDER, (g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px),
false);
break;
case KEY_PAGE_DOWN:
- guiwin_scroll(w, GUIWIN_VSLIDER, (g.g_h/slid->y_unit_px),
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px),
false);
break;
case KEY_RIGHT:
- guiwin_scroll(w, GUIWIN_HSLIDER, -1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -1, false);
break;
case KEY_LEFT:
- guiwin_scroll(w, GUIWIN_HSLIDER, 1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, 1, false);
break;
case KEY_UP:
- guiwin_scroll(w, GUIWIN_VSLIDER, -1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, -1, false);
break;
case KEY_DOWN:
- guiwin_scroll(w, GUIWIN_VSLIDER, 1, false);
+ gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, 1, false);
break;
default:
break;
}
- guiwin_update_slider(w, GUIWIN_VSLIDER|GUIWIN_HSLIDER);
+ gemtk_wm_update_slider(w, GEMTK_WM_VSLIDER|GEMTK_WM_HSLIDER);
}
}
@@ -1307,18 +1304,20 @@ static short on_window_key_input(ROOTWIN *rootwin, unsigned short
nkc)
/* make sure we report for the root window and report...: */
done = toolbar_key_input(gw->root->toolbar, nkc);
} else {
- gw_tmp = window_list;
- /* search for active browser component: */
- while( gw_tmp != NULL && done == false ) {
- /* todo: only handle when input_window == ontop */
- if( window_widget_has_focus(input_window->root, BROWSER,
- (void*)gw_tmp->browser)) {
- done = on_content_keypress(gw_tmp->browser->bw, nkc);
- break;
- } else {
- gw_tmp = gw_tmp->next;
- }
- }
+ if( window_widget_has_focus(input_window->root, BROWSER,
+ (void*)input_window->browser)) {
+ done = on_content_keypress(input_window->browser->bw, nkc);
+ }
+ else if(window_widget_has_focus(input_window->root, SEARCH_INPUT, NULL)) {
+ OBJECT * obj;
+ obj = toolbar_get_form(input_window->root->toolbar);
+ obj[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED;
+ obj[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED;
+ window_schedule_redraw_grect(input_window->root,
+ gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_FWD));
+ window_schedule_redraw_grect(input_window->root,
+ gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_BACK));
+ }
}
return((done==true) ? 1 : 0);
}
@@ -1332,7 +1331,7 @@ static void on_redraw(ROOTWIN *rootwin, short msg[8])
//dbg_grect("on_redraw", &clip);
- if(guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED) {
+ if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
GRECT clip = {msg[4], msg[5], msg[6], msg[7]};
window_redraw_favicon(rootwin, &clip);
} else {
@@ -1356,7 +1355,7 @@ static void on_resized(ROOTWIN *rootwin)
return;
wind_get_grect(rootwin->aes_handle, WF_CURRXYWH, &g);
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work);
if (rootwin->loc.g_w != g.g_w || rootwin->loc.g_h != g.g_h) {
@@ -1398,22 +1397,22 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
if( gw == NULL )
return;
- if(guiwin_get_state(rootwin->win) & GW_STATUS_ICONIFIED)
+ if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED)
return;
- dd_hdl = ddopen( msg[7], DD_OK);
+ dd_hdl = gemtk_dd_open( msg[7], DD_OK);
if( dd_hdl<0)
return; /* pipe not open */
memset( ext, 0, 32);
strcpy( ext, "ARGS");
- dd_msg = ddsexts( dd_hdl, ext);
+ dd_msg = gemtk_dd_sexts( dd_hdl, ext);
if( dd_msg<0)
goto error;
- dd_msg = ddrtry( dd_hdl, (char*)&name[0], (char*)&file[0],
(char*)&ext[0], &size);
+ dd_msg = gemtk_dd_rtry( dd_hdl, (char*)&name[0], (char*)&file[0],
(char*)&ext[0], &size);
if( size+1 >= PATH_MAX )
goto error;
if( !strncmp( ext, "ARGS", 4) && dd_msg > 0) {
- ddreply(dd_hdl, DD_OK);
+ gemtk_dd_reply(dd_hdl, DD_OK);
buff = (char*)malloc(sizeof(char)*(size+1));
if (buff != NULL) {
if (Fread(dd_hdl, size, buff ) == size)
@@ -1454,7 +1453,7 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
}
}
error:
- ddclose( dd_hdl);
+ gemtk_dd_close( dd_hdl);
}
static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip)
@@ -1462,7 +1461,7 @@ static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT
*clip)
struct rootwin_data_s * ud;
if (msg != WM_REDRAW) {
- ud = guiwin_get_user_data(win);
+ ud = gemtk_wm_get_user_data(win);
assert(ud);
diff --git a/atari/rootwin.h b/atari/rootwin.h
index 3be8ecf..d2cd04a 100755
--- a/atari/rootwin.h
+++ b/atari/rootwin.h
@@ -21,7 +21,7 @@
#include <atari/gui.h>
-#define GUIWIN_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
+#define GEMTK_WM_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
#define GEMWIN_VISIBLE(win) (win->status & WS_OPEN)
#define WIDGET_STATUSBAR 0x1
diff --git a/atari/search.c b/atari/search.c
index 8569548..17241d1 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -39,6 +39,7 @@
#include "atari/gui.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
+#include "atari/toolbar.h"
#include "atari/search.h"
#include "atari/gemtk/gemtk.h"
#include "atari/res/netsurf.rsh"
@@ -110,11 +111,24 @@ void nsatari_search_add_recent(const char *string, void *p)
*/
void nsatari_search_set_forward_state(bool active, void *p)
-{
+{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set forward state: %d\n", p, active));
- // TODO: update gui
+
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
+
}
/**
@@ -125,12 +139,23 @@ void nsatari_search_set_forward_state(bool active, void *p)
void nsatari_search_set_back_state(bool active, void *p)
{
+ struct gui_window *gw;
+ OBJECT *toolbar;
+ GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
LOG(("%p: set back state: %d\n", p, active));
- s->state.back_avail = true;
- // TODO: update gui
+ s->state.back_avail = active;
+ gw = s->bw->window;
+
+ toolbar = toolbar_get_form(gw->root->toolbar);
+ if(active)
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED;
+ else
+ toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state |= OS_DISABLED;
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+ window_schedule_redraw_grect(gw->root, &area);
}
@@ -147,7 +172,7 @@ static int apply_form(OBJECT *obj, struct s_search_form_state *s)
if( (obj[TOOLBAR_CB_SHOWALL].ob_state & OS_SELECTED) != 0 )
s->flags |= SEARCH_FLAG_SHOWALL;
- cstr = get_text(obj, TOOLBAR_TB_SRCH);
+ cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH);
snprintf(s->text, 32, "%s", cstr);
return ( 0 );
@@ -204,7 +229,7 @@ void nsatari_search_session_destroy(struct s_search_form_session *s)
}
}
-/* checks for search parameters changes */
+/** checks for search parameters changes */
static bool search_session_compare(struct s_search_form_session *s, OBJECT *obj)
{
bool check;
@@ -222,7 +247,7 @@ static bool search_session_compare(struct s_search_form_session *s,
OBJECT *obj)
}
char * cstr;
- cstr = get_text(obj, TOOLBAR_TB_SRCH);
+ cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH);
if (cstr != NULL){
if (strcmp(cstr, (char*)&s->state.text) != 0) {
return (true);
@@ -240,10 +265,11 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT
*obj,
bool fwd;
search_flags_t flags = f;
- assert(s!=null);
+ assert(s!=null);
+ assert(input_window->browser->bw == s->bw);
+
if(search_session_compare(s, obj)){
- printf("reset search form\n");
browser_window_search_destroy_context(s->bw);
apply_form(obj, &s->state);
} else {
@@ -257,9 +283,9 @@ void nsatari_search_perform(struct s_search_form_session *s, OBJECT
*obj,
s->state.flags &= (~SEARCH_FLAG_FORWARDS);
if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){
- LOG(("searching for: %s\n", get_text(obj, TOOLBAR_TB_SRCH)));
+ LOG(("searching for: %s\n", gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH)));
browser_window_search_step(s->bw, s->state.flags,
- get_text(obj, TOOLBAR_TB_SRCH));
+ gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH));
}
}
diff --git a/atari/settings.c b/atari/settings.c
index 546f56a..4f73fc3 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -46,16 +46,16 @@ static OBJECT * dlgtree;
#define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED));
-#define OBJ_REDRAW(idx) guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+#define OBJ_REDRAW(idx) gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \
- guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+ gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)); \
- guiwin_send_redraw(settings_guiwin, \
- obj_screen_rect(dlgtree, idx));
+ gemtk_wm_send_redraw(settings_guiwin, \
+ gemtk_obj_screen_rect(dlgtree, idx));
#define FORMEVENT(idx) form_event(idx, 0);
@@ -181,21 +181,21 @@ static void display_settings(void)
set_text( SETTINGS_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver),
LABEL_FONT_RENDERER_MAX_LEN );
SET_BIT(dlgtree[SETTINGS_CB_TRANSPARENCY].ob_state,
- GW_CB_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
+ OS_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_ENABLE_ANIMATION].ob_state,
- GW_CB_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_FG_IMAGES].ob_state,
- GW_CB_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_BG_IMAGES].ob_state,
- GW_CB_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(background_images) ? 1 : 0 );
// TODO: enable this option?
/* SET_BIT(dlgtree[SETTINGS_CB_INCREMENTAL_REFLOW].ob_state,
- GW_CB_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );*/
+ OS_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );*/
SET_BIT(dlgtree[SETTINGS_CB_ANTI_ALIASING].ob_state,
- GW_CB_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
+ OS_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
// TODO: activate this option?
@@ -221,9 +221,9 @@ static void display_settings(void)
set_text( SETTINGS_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass),
INPUT_PROXY_PASSWORD_MAX_LEN );
SET_BIT(dlgtree[SETTINGS_CB_USE_PROXY].ob_state,
- GW_CB_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
+ OS_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
SET_BIT(dlgtree[SETTINGS_CB_PROXY_AUTH].ob_state,
- GW_CB_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
+ OS_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles);
snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) );
@@ -320,7 +320,7 @@ static void form_event(int index, int external)
if( external ) {
objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y);
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_FONT_RENDERER);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_FONT_RENDERER);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_FONT_RENDERER_INTERNAL;
pop_menu.mn_scroll = SCROLL_NO;
@@ -329,7 +329,7 @@ static void form_event(int index, int external)
// find the selected menu item and uncheck others:
for(i=pop_menu.mn_item; i<=num_font_drivers; i++) {
get_string(pop_menu.mn_tree, i, spare);
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
if (strcasecmp(&spare[2], tmp)) {
menu_icheck(pop_menu.mn_tree, i, 0);
} else {
@@ -351,7 +351,7 @@ static void form_event(int index, int external)
OBJ_REDRAW(SETTINGS_BT_SEL_FONT_RENDERER);
}
}
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
if (strcasecmp(tmp, "freetype") == 0) {
ENABLE_OBJ(SETTINGS_CB_ANTI_ALIASING);
} else {
@@ -363,7 +363,7 @@ static void form_event(int index, int external)
objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y);
// point mn_tree tree to states popup:
- pop_menu.mn_tree = get_tree(POP_LANGUAGE);
+ pop_menu.mn_tree = gemtk_obj_get_tree(POP_LANGUAGE);
pop_menu.mn_menu = 0;
pop_menu.mn_item = POP_LANGUAGE_CS;
pop_menu.mn_scroll = SCROLL_NO;
@@ -372,7 +372,7 @@ static void form_event(int index, int external)
// find the selected menu item and uncheck others:
for(i=pop_menu.mn_item; i<=num_locales; i++) {
get_string(pop_menu.mn_tree, i, spare);
- tmp = get_text(dlgtree, SETTINGS_BT_SEL_LOCALE);
+ tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE);
if (strcasecmp(&spare[2], tmp)) {
menu_icheck(pop_menu.mn_tree, i, 0);
} else {
@@ -586,19 +586,19 @@ static void apply_settings(void)
nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
}
nsoption_set_charp(http_proxy_auth_pass,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD));
nsoption_set_charp(http_proxy_auth_user,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME));
nsoption_set_charp(http_proxy_host,
- get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST));
nsoption_set_int(http_proxy_port,
- atoi( get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) ));
+ atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) ));
nsoption_set_int(max_fetchers_per_host,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS_PER_HOST)));
+ atoi( gemtk_obj_get_text(dlgtree,
SETTINGS_EDIT_MAX_FETCHERS_PER_HOST)));
nsoption_set_int(max_cached_fetch_handles,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_CACHED_CONNECTIONS)));
+ atoi( gemtk_obj_get_text(dlgtree,
SETTINGS_EDIT_MAX_CACHED_CONNECTIONS)));
nsoption_set_int(max_fetchers,
- atoi( get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) ));
+ atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) ));
nsoption_set_bool(foreground_images,
OBJ_SELECTED( SETTINGS_CB_FG_IMAGES ));
nsoption_set_bool(background_images,
@@ -610,7 +610,7 @@ static void apply_settings(void)
/* "Rendering" tab: */
nsoption_set_charp(atari_font_driver,
- get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER));
+ gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER));
nsoption_set_bool(atari_transparency,
OBJ_SELECTED(SETTINGS_CB_TRANSPARENCY));
nsoption_set_bool(animate_images,
@@ -625,17 +625,17 @@ static void apply_settings(void)
/* "Paths" tabs: */
nsoption_set_charp(ca_bundle,
- get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE));
nsoption_set_charp(ca_path,
- get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
nsoption_set_charp(homepage_url,
- get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
nsoption_set_charp(hotlist_file,
- get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE));
nsoption_set_charp(atari_editor,
- get_text(dlgtree, SETTINGS_EDIT_EDITOR));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_EDITOR));
nsoption_set_charp(downloads_path,
- get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH));
/* "Cache" tab: */
nsoption_set_int(memory_cache_size,
@@ -647,15 +647,15 @@ static void apply_settings(void)
nsoption_set_bool(block_ads,
OBJ_SELECTED(SETTINGS_CB_HIDE_ADVERTISEMENT));
nsoption_set_charp(accept_language,
- get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
nsoption_set_int(expire_url,
- atoi(get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE)));
+ atoi(gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE)));
nsoption_set_bool(send_referer,
OBJ_SELECTED(SETTINGS_CB_SEND_HTTP_REFERRER));
nsoption_set_bool(do_not_track,
OBJ_SELECTED(SETTINGS_CB_SEND_DO_NOT_TRACK));
nsoption_set_charp(homepage_url,
- get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE));
+ gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE));
}
static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
@@ -663,7 +663,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
short retval = 0;
GRECT clip, work;
static short edit_idx = 0;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if ((ev_out->emo_events & MU_MESAG) != 0) {
// handle message
@@ -678,7 +678,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
break;
case WM_SIZED:
- guiwin_update_slider(win, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(win, GEMTK_WM_VH_SLIDER);
break;
case WM_MOVED:
@@ -691,7 +691,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short
msg[8])
}
break;
- case GUIWIN_WM_FORM:
+ case GEMTK_WM_WM_FORM_CLICK:
form_event(msg[4], 1);
break;
@@ -714,18 +714,18 @@ void open_settings(void)
if (h_aes_win == 0) {
GRECT curr, area;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
uint32_t kind = CLOSER | NAME | MOVER | VSLIDE | HSLIDE | UPARROW
| DNARROW | LFARROW | RTARROW | SIZER | FULLER;
- dlgtree = get_tree(SETTINGS);
+ dlgtree = gemtk_obj_get_tree(SETTINGS);
area.g_x = area.g_y = 0;
area.g_w = MIN(dlgtree->ob_width, desk_area.g_w);
area.g_h = MIN(dlgtree->ob_height, desk_area.g_h);
wind_calc_grect(WC_BORDER, kind, &area, &area);
h_aes_win = wind_create_grect(kind, &area);
wind_set_str(h_aes_win, WF_NAME, "Settings");
- settings_guiwin = guiwin_add(h_aes_win, GW_FLAG_DEFAULTS,
+ settings_guiwin = gemtk_wm_add(h_aes_win, GEMTK_WM_FLAG_DEFAULTS,
on_aes_event);
curr.g_w = MIN(dlgtree->ob_width, desk_area.g_w);
curr.g_h = MIN(dlgtree->ob_height, desk_area.g_h-64);
@@ -742,22 +742,22 @@ void open_settings(void)
wind_open_grect(h_aes_win, &curr);
- guiwin_set_form(settings_guiwin, dlgtree, 0);
- guiwin_set_scroll_grid(settings_guiwin, 32, 32);
- guiwin_get_grect(settings_guiwin, GUIWIN_AREA_CONTENT, &area);
+ gemtk_wm_set_form(settings_guiwin, dlgtree, 0);
+ gemtk_wm_set_scroll_grid(settings_guiwin, 32, 32);
+ gemtk_wm_get_grect(settings_guiwin, GEMTK_WM_AREA_CONTENT, &area);
- slid = guiwin_get_scroll_info(settings_guiwin);
- guiwin_set_content_units(settings_guiwin,
+ slid = gemtk_wm_get_scroll_info(settings_guiwin);
+ gemtk_wm_set_content_units(settings_guiwin,
(dlgtree->ob_width/slid->x_unit_px),
(dlgtree->ob_height/slid->y_unit_px));
- guiwin_update_slider(settings_guiwin, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(settings_guiwin, GEMTK_WM_VH_SLIDER);
}
}
void close_settings(void)
{
LOG((""));
- guiwin_remove(settings_guiwin);
+ gemtk_wm_remove(settings_guiwin);
settings_guiwin = NULL;
wind_close(h_aes_win);
wind_delete(h_aes_win);
diff --git a/atari/statusbar.c b/atari/statusbar.c
index d43ebc8..9f26d7b 100755
--- a/atari/statusbar.c
+++ b/atari/statusbar.c
@@ -220,7 +220,7 @@ void sb_destroy( CMP_STATUSBAR s )
void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw)
{
- sb->aes_win = guiwin_get_handle(gw->root->win);
+ sb->aes_win = gemtk_wm_get_handle(gw->root->win);
sb->attached = true;
}
diff --git a/atari/toolbar.c b/atari/toolbar.c
index a6b7930..0f032b2 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -223,10 +223,27 @@ static struct s_tb_button *button_init(struct s_toolbar *tb, OBJECT
* tree, int
}
+static short __CDECL toolbar_url_userdraw(PARMBLK *parmblock)
+{
+ return(0);
+}
+
void toolbar_init( void )
{
- aes_toolbar = get_tree(TOOLBAR);
- throbber_form = get_tree(THROBBER);
+ static USERBLK userblk;
+
+ aes_toolbar = gemtk_obj_get_tree(TOOLBAR);
+ throbber_form = gemtk_obj_get_tree(THROBBER);
+
+ userblk.ub_code = toolbar_url_userdraw;
+ userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
+ aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk;
+
+ aes_toolbar[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
+ aes_toolbar[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
+
+ /* init default values: */
+ gemtk_obj_set_str_safe(aes_toolbar, TOOLBAR_TB_SRCH, (char*)"");
area_full_height = aes_toolbar->ob_height;
area_search_height = aes_toolbar[TOOLBAR_AREA_SEARCH].ob_height;
@@ -252,16 +269,260 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
assert(init == true);
+<<<<<<< HEAD
t = calloc(sizeof(struct s_toolbar), 1);
+=======
+static
+void __CDECL evnt_url_click( COMPONENT *c, long buff[8] )
+{
+ LGRECT work;
+ short pxy[4];
+ short mx, my, mb, kstat;
+ int old;
+ graf_mkstate( &mx, &my, &mb, &kstat );
+ struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, c,
CDT_OWNER);
+ assert( gw != NULL );
+ CMP_TOOLBAR tb = gw->root->toolbar;
+ mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
+ mx = evnt.mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
+ my = evnt.my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
+
+ /* TODO: reset mouse state of browser window? */
+ /* select whole text when newly focused, otherwise set caret to end of text */
+ if( !window_url_widget_has_focus(gw) ) {
+ window_set_focus( gw, URL_WIDGET, (void*)&tb->url );
+ } else {
+ if( mb & 1 ) {
+ textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_DRAG_1,
+ mx, my );
+ short prev_x = mx;
+ short prev_y = my;
+ do{
+ if( abs(prev_x-mx) > 5 || abs(prev_y-my) > 5 ){
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_HOLDING_1, mx, my );
+ prev_x = mx;
+ prev_y = my;
+ if( tb->url.redraw ){
+ tb_url_redraw( gw );
+ }
+ }
+ graf_mkstate( &mx, &my, &mb, &kstat );
+ mx = mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
+ my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
+ }while( mb & 1 );
+ textarea_mouse_action( tb->url.textarea, BROWSER_MOUSE_HOVER, mx, my );
+ } else {
+ /* TODO: recognize click + shift key */
+ int mstate = BROWSER_MOUSE_PRESS_1;
+ if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 )
+ mstate = BROWSER_MOUSE_MOD_1;
+ if( evnt.nb_click == 2 ){
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_DOUBLE_CLICK | BROWSER_MOUSE_CLICK_1,
+ mx, my );
+ } else {
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_PRESS_1, mx, my );
+ }
+ }
+ }
+ // TODO: do not send an complete redraw!
+ ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
+ work.g_x, work.g_y, work.g_w, work.g_h );
+}
+>>>>>>> master
assert(t);
+<<<<<<< HEAD
/* initialize the toolbar values: */
t->owner = owner;
t->style = 1;
t->search_visible = false;
t->visible = true;
- t->reflow = true;
+ t->reflow = true;
+
+ /* dublicate the form template: */
+ t->form = gemtk_obj_tree_copy(aes_toolbar);
+=======
+void tb_adjust_size( struct gui_window * gw )
+{
+ LGRECT work;
+ CMP_TOOLBAR t = gw->root->toolbar;
+
+ mt_CompGetLGrect( &app, t->url.comp, WF_WORKXYWH, &work);
+ work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
+ /* do not overwrite the black border, because of that, add 1 */
+ work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
+ textarea_set_dimensions( t->url.textarea, work.g_w, work.g_h );
+ tb_txt_request_redraw( t, 0,0, work.g_w-1, work.g_h-1);
+}
+
+static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data )
+{
+ LGRECT work, clip;
+ short pxy[4];
+ const plot_style_t plot_style_background = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = toolbar_bg_color,
+ .stroke_type = PLOT_OP_TYPE_NONE
+ };
+
+ mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
+ clip = work;
+ if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
+ if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
+
+ vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
+ vsl_color(atari_plot_vdi_handle, BLACK );
+ vsl_type(atari_plot_vdi_handle, 1 );
+ vsl_width(atari_plot_vdi_handle, 1 );
+ pxy[0] = clip.g_x;
+ pxy[1] = pxy[3] = work.g_y + work.g_h-1 ;
+ pxy[2] = clip.g_x + clip.g_w;
+ v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
+}
+
+
+static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
+{
+ LGRECT work;
+ if( data == NULL )
+ return;
+ CMP_TOOLBAR t = data;
+ if( t->url.redraw == false ){
+ t->url.redraw = true;
+ //t->redraw = true;
+ t->url.rdw_area.g_x = x;
+ t->url.rdw_area.g_y = y;
+ t->url.rdw_area.g_w = w;
+ t->url.rdw_area.g_h = h;
+ } else {
+ /* merge the redraw area to the new area.: */
+ int newx1 = x+w;
+ int newy1 = y+h;
+ int oldx1 = t->url.rdw_area.g_x + t->url.rdw_area.g_w;
+ int oldy1 = t->url.rdw_area.g_y + t->url.rdw_area.g_h;
+ t->url.rdw_area.g_x = MIN(t->url.rdw_area.g_x, x);
+ t->url.rdw_area.g_y = MIN(t->url.rdw_area.g_y, y);
+ t->url.rdw_area.g_w = ( oldx1 > newx1 ) ?
+ oldx1 - t->url.rdw_area.g_x : newx1 - t->url.rdw_area.g_x;
+ t->url.rdw_area.g_h = ( oldy1 > newy1 ) ?
+ oldy1 - t->url.rdw_area.g_y : newy1 - t->url.rdw_area.g_y;
+ }
+}
+
+
+static void tb_txt_callback(void *data, struct textarea_msg *msg)
+{
+ switch (msg->type) {
+ case TEXTAREA_MSG_DRAG_REPORT:
+ break;
+
+ case TEXTAREA_MSG_REDRAW_REQUEST:
+ tb_txt_request_redraw(data,
+ msg->data.redraw.x0, msg->data.redraw.y0,
+ msg->data.redraw.x1 - msg->data.redraw.x0,
+ msg->data.redraw.y1 - msg->data.redraw.y0);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void tb_url_redraw( struct gui_window * gw )
+{
+
+ CMP_TOOLBAR t = gw->root->toolbar;
+ if (t != NULL) {
+ if( t->url.redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) )
{
+
+ const struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
+ short todo[4];
+ LGRECT work;
+
+ mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH,
&work);
+ work.g_x += TOOLBAR_URL_MARGIN_RIGHT;
+ work.g_y += TOOLBAR_URL_MARGIN_LEFT;
+ work.g_w -= TOOLBAR_URL_MARGIN_RIGHT;
+ work.g_h -= TOOLBAR_URL_MARGIN_BOTTOM;
+
+ plot_set_dimensions( work.g_x, work.g_y, work.g_w, work.g_h );
+ if(plot_lock() == false)
+ return;
+
+ todo[0] = work.g_x;
+ todo[1] = work.g_y;
+ todo[2] = todo[0] + work.g_w-1;
+ todo[3] = todo[1] + work.g_h-1;
+ vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
+
+ if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
+ while (todo[2] && todo[3]) {
+
+ /* convert screen to relative coords: */
+ todo[0] = todo[0] - work.g_x;
+ todo[1] = todo[1] - work.g_y;
+ if( todo[0] < 0 ){
+ todo[2] = todo[2] + todo[0];
+ todo[0] = 0;
+ }
+ if( todo[1] < 0 ){
+ todo[3] = todo[3] + todo[1];
+ todo[1] = 0;
+ }
+
+ if (rc_intersect(&t->url.rdw_area,(GRECT *)&todo)) {
+ struct rect clip = {
+ .x0 = todo[0],
+ .y0 = todo[1],
+ .x1 = todo[0]+todo[2],
+ .y1 = todo[1]+todo[3]
+ };
+ textarea_redraw( t->url.textarea, 0, 0, 0xffffff, &clip, &ctx );
+ }
+ if (wind_get(gw->root->handle->handle, WF_NEXTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3])==0) {
+ break;
+ }
+ }
+ } else {
+ plot_unlock();
+ return;
+ }
+ plot_unlock();
+ vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
+ t->url.redraw = false;
+ t->url.rdw_area.g_x = 65000;
+ t->url.rdw_area.g_y = 65000;
+ t->url.rdw_area.g_w = -1;
+ t->url.rdw_area.g_h = -1;
+ } else {
+ /* just copy stuff from the offscreen buffer */
+ }
+ }
+}
+
+CMP_TOOLBAR tb_create( struct gui_window * gw )
+{
+ int i;
+
+
+ CMP_TOOLBAR t = malloc( sizeof(struct s_toolbar) );
+ if( t == NULL )
+ return( NULL );
+
+ t->owner = gw;
+ t->style = 1;
+>>>>>>> master
+
/* count buttons and add them as components: */
i = 0;
@@ -270,8 +531,8 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
}
t->btcnt = i;
t->buttons = malloc(t->btcnt * sizeof(struct s_tb_button));
- memset( t->buttons, 0, t->btcnt * sizeof(struct s_tb_button));
- for (i=0; i < t->btcnt; i++ ) {
+ memset(t->buttons, 0, t->btcnt * sizeof(struct s_tb_button));
+ for (i=0; i < t->btcnt; i++) {
button_init(t, aes_toolbar, i, &t->buttons[i]);
}
@@ -279,10 +540,41 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
font_style_url.size =
toolbar_styles[t->style].font_height_pt * FONT_SIZE_SCALE;
+<<<<<<< HEAD
toolbar_get_grect(t, TOOLBAR_AREA_URL, &url_area);
url_area.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
t->url.textarea = textarea_create(300, url_area.g_h, 0, &font_style_url,
tb_txt_request_redraw, t);
+=======
+ int ta_height = toolbar_styles[t->style].height;
+ ta_height -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
+ textarea_setup ta_setup;
+ ta_setup.flags = TEXTAREA_INTERNAL_CARET;
+ ta_setup.width = 300;
+ ta_setup.height = ta_height;
+ ta_setup.pad_top = 0;
+ ta_setup.pad_right = 4;
+ ta_setup.pad_bottom = 0;
+ ta_setup.pad_left = 4;
+ ta_setup.border_width = 1;
+ ta_setup.border_col = 0x000000;
+ ta_setup.selected_text = 0xffffff;
+ ta_setup.selected_bg = 0x000000;
+ ta_setup.text = font_style_url;
+ ta_setup.text.foreground = 0x000000;
+ ta_setup.text.background = 0xffffff;
+ t->url.textarea = textarea_create( &ta_setup, tb_txt_callback, t );
+ if( t->url.textarea != NULL ){
+ textarea_set_text(t->url.textarea, "http://");
+ }
+
+ t->url.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL,
+ toolbar_styles[t->style].height, 1);
+ mt_CompEvntDataAttach( &app, t->url.comp, WM_REDRAW, evnt_url_redraw, t);
+ mt_CompEvntAttach( &app, t->url.comp, WM_XBUTTON, evnt_url_click );
+ mt_CompDataAttach( &app, t->url.comp, CDT_OWNER, gw );
+ mt_CompAttach( &app, t->comp, t->url.comp );
+>>>>>>> master
/* create the throbber widget: */
t->throbber.index = THROBBER_INACTIVE_INDEX;
@@ -298,7 +590,10 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
void toolbar_destroy(struct s_toolbar *tb)
{
free(tb->buttons);
+ free(tb->form);
+
textarea_destroy(tb->url.textarea);
+
free(tb);
}
@@ -324,56 +619,56 @@ static void toolbar_reflow(struct s_toolbar *tb)
int i;
// position toolbar areas:
- aes_toolbar->ob_x = tb->area.g_x;
- aes_toolbar->ob_y = tb->area.g_y;
- aes_toolbar->ob_width = tb->area.g_w;
- aes_toolbar->ob_height = toolbar_calculate_height(tb);
+ tb->form->ob_x = tb->area.g_x;
+ tb->form->ob_y = tb->area.g_y;
+ tb->form->ob_width = tb->area.g_w;
+ tb->form->ob_height = toolbar_calculate_height(tb);
// expand the "main" areas to the current width:
- aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w;
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w;
+ tb->form[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w;
if (tb->search_visible) {
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
} else {
- aes_toolbar[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
+ tb->form[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
}
// align the throbber area at right edge:
- aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w
- - aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width;
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_THROBBER_AREA].ob_width;
// align the search button:
- aes_toolbar[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w
- - aes_toolbar[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
+ tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w
+ - tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
// center the URL area:
- aes_toolbar[TOOLBAR_AREA_URL].ob_width = tb->area.g_w
- - (aes_toolbar[TOOLBAR_AREA_BUTTONS].ob_width
- + aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width + 1);
+ tb->form[TOOLBAR_AREA_URL].ob_width = tb->area.g_w
+ - (tb->form[TOOLBAR_AREA_BUTTONS].ob_width
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_width + 1);
// position throbber image:
throbber_form[tb->throbber.index].ob_x = tb->area.g_x +
- aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x;
+ tb->form[TOOLBAR_THROBBER_AREA].ob_x;
throbber_form[tb->throbber.index].ob_x = tb->area.g_x
- + aes_toolbar[TOOLBAR_THROBBER_AREA].ob_x +
- ((aes_toolbar[TOOLBAR_THROBBER_AREA].ob_width
+ + tb->form[TOOLBAR_THROBBER_AREA].ob_x +
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_width
- throbber_form[tb->throbber.index].ob_width) >> 1);
throbber_form[tb->throbber.index].ob_y = tb->area.g_y +
- ((aes_toolbar[TOOLBAR_THROBBER_AREA].ob_height
+ ((tb->form[TOOLBAR_THROBBER_AREA].ob_height
- throbber_form[tb->throbber.index].ob_height) >> 1);
// set button states:
for (i=0; i < tb->btcnt; i++ ) {
if (tb->buttons[i].state == button_off) {
- aes_toolbar[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED;
+ tb->form[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED;
}
else if (tb->buttons[i].state == button_on) {
- aes_toolbar[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED;
+ tb->form[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED;
}
}
tb->reflow = false;
@@ -395,7 +690,7 @@ void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
//dbg_grect("toolbar redraw clip", clip);
- objc_draw_grect(aes_toolbar,0,8,clip);
+ objc_draw_grect(tb->form,0,8,clip);
objc_draw_grect(&throbber_form[tb->throbber.index], 0, 1, clip);
toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area_ro);
@@ -438,11 +733,11 @@ void toolbar_update_buttons(struct s_toolbar *tb, struct
browser_window *bw,
}
}
- if (button == TOOLBAR_BT_HOME || button <= 0 ){
+ if (button == TOOLBAR_BT_HOME || button <= 0 ) {
}
- if( button == TOOLBAR_BT_FORWARD || button <= 0 ){
+ if (button == TOOLBAR_BT_FORWARD || button <= 0 ) {
bt = find_button(tb, TOOLBAR_BT_FORWARD);
enable = browser_window_forward_available(bw);
if (enable) {
@@ -452,7 +747,7 @@ void toolbar_update_buttons(struct s_toolbar *tb, struct
browser_window *bw,
}
}
- if( button == TOOLBAR_BT_RELOAD || button <= 0 ){
+ if (button == TOOLBAR_BT_RELOAD || button <= 0 ) {
bt = find_button(tb, TOOLBAR_BT_RELOAD);
enable = browser_window_reload_available(bw);
if (enable) {
@@ -498,8 +793,8 @@ void toolbar_set_width(struct s_toolbar *tb, short w)
toolbar_reflow(tb);
/* this will request an textarea redraw: */
textarea_set_dimensions(tb->url.textarea,
- aes_toolbar[TOOLBAR_AREA_URL].ob_width,
- aes_toolbar[TOOLBAR_AREA_URL].ob_height);
+ tb->form[TOOLBAR_AREA_URL].ob_width,
+ tb->form[TOOLBAR_AREA_URL].ob_height);
tb->reflow = true;
}
}
@@ -527,8 +822,8 @@ void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area)
toolbar_reflow(tb);
/* this will request an textarea redraw: */
textarea_set_dimensions(tb->url.textarea,
- aes_toolbar[TOOLBAR_AREA_URL].ob_width,
- aes_toolbar[TOOLBAR_AREA_URL].ob_height);
+ tb->form[TOOLBAR_AREA_URL].ob_width,
+ tb->form[TOOLBAR_AREA_URL].ob_height);
}
else {
tb->area = *area;
@@ -590,7 +885,7 @@ void toolbar_set_visible(struct s_toolbar *tb, short area, bool
visible)
void toolbar_set_reflow(struct s_toolbar *tb, bool do_reflow)
{
- tb->reflow = true;
+ tb->reflow = do_reflow;
}
void toolbar_set_attached(struct s_toolbar *tb, bool attached)
@@ -629,17 +924,17 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text)
bool toolbar_key_input(struct s_toolbar *tb, short nkc)
{
- assert(tb!=NULL);
- GRECT work;
+ assert(tb!=NULL);
+
+ GRECT work;
bool ret = false;
-
struct gui_window *gw = window_get_active_gui_window(tb->owner);
assert( gw != NULL );
long ucs4;
long ik = nkc_to_input_key(nkc, &ucs4);
-
+
if (ik == 0) {
if ((nkc&0xFF) >= 9) {
ret = textarea_keypress(tb->url.textarea, ucs4);
@@ -717,10 +1012,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
/* select whole text when newly focused, otherwise set caret to
end of text */
if (!window_url_widget_has_focus(tb->owner)) {
- window_set_focus(tb->owner, URL_WIDGET, (void*)&tb->url );
- }
- if (button & 2) {
- // TODO: open a context popup
+ window_set_focus(tb->owner, URL_WIDGET, (void*)&tb->url);
}
/* url widget has focus and mouse button is still pressed... */
else if (mb & 1) {
@@ -743,16 +1035,19 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP);
} while (mb & 1);
- textarea_drag_end( tb->url.textarea, 0, mx, my );
+ textarea_drag_end( tb->url.textarea, 0, mx, my);
+ }
+ else if (button & 2) {
+ // TODO: open a context popup
}
else {
/* when execution reaches here, mouse input is a click or dclick */
/* TODO: recognize click + shitoolbar_update_buttonsft key */
int mstate = BROWSER_MOUSE_PRESS_1;
- if( (kstat & (K_LSHIFT|K_RSHIFT)) != 0 ){
+ if ((kstat & (K_LSHIFT|K_RSHIFT)) != 0) {
mstate = BROWSER_MOUSE_MOD_1;
}
- if( aes_event_out.emo_mclicks == 2 ){
+ if (aes_event_out.emo_mclicks == 2 ) {
textarea_mouse_action( tb->url.textarea,
BROWSER_MOUSE_DOUBLE_CLICK | BROWSER_MOUSE_CLICK_1, mx,
my);
@@ -764,13 +1059,21 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short
button)
}
}
}
+ else if(obj==TOOLBAR_TB_SRCH) {
+ window_set_focus(tb->owner, SEARCH_INPUT, NULL);
+ }
else if (obj==TOOLBAR_BT_SEARCH_FWD) {
gw = tb->owner->active_gui_window;
- toolbar_tree = get_tree(TOOLBAR);
assert(gw->search);
- nsatari_search_perform(gw->search, toolbar_tree, SEARCH_FLAG_FORWARDS);
+ nsatari_search_perform(gw->search, tb->form, SEARCH_FLAG_FORWARDS);
+ }
+ else if (obj==TOOLBAR_BT_SEARCH_BACK) {
+ gw = tb->owner->active_gui_window;
+ assert(gw->search);
+ nsatari_search_perform(gw->search, tb->form, 0);
}
else if (obj==TOOLBAR_BT_CLOSE_SEARCH) {
+ tb->form[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED;
window_close_search(tb->owner);
}
else {
@@ -802,11 +1105,11 @@ void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT
*dst)
toolbar_reflow(tb);
}
- objc_offset(aes_toolbar, which, &dst->g_x, &dst->g_y);
+ objc_offset(tb->form, which, &dst->g_x, &dst->g_y);
- dst->g_w = aes_toolbar[which].ob_width;
- dst->g_h = aes_toolbar[which].ob_height;
- //aes_toolbar[which].ob_height;
+ dst->g_w = tb->form[which].ob_width;
+ dst->g_h = tb->form[which].ob_height;
+ //tb->form[which].ob_height;
//printf("Toolbar get grect (%d): ", which);
//dbg_grect("", dst);
@@ -821,6 +1124,11 @@ struct textarea *toolbar_get_textarea(struct s_toolbar *tb,
return(tb->url.textarea);
}
+OBJECT *toolbar_get_form(struct s_toolbar *tb)
+{
+ return(tb->form);
+}
+
/* public event handler */
void toolbar_back_click(struct s_toolbar *tb)
diff --git a/atari/toolbar.h b/atari/toolbar.h
index 24ea9e2..3116aa9 100644
--- a/atari/toolbar.h
+++ b/atari/toolbar.h
@@ -31,13 +31,13 @@ struct s_toolbar
struct s_gui_win_root *owner;
struct s_url_widget url;
struct s_throbber_widget throbber;
+ OBJECT *form;
GRECT area;
/* size & location of buttons: */
struct s_tb_button * buttons;
int btcnt;
int style;
bool attached;
- bool redraw;
bool reflow;
bool visible;
bool search_visible;
@@ -54,6 +54,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short mbut);
void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw,
short idx);
void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT *g);
+OBJECT *toolbar_get_form(struct s_toolbar *tb);
struct textarea *toolbar_get_textarea(struct s_toolbar *tb,
enum toolbar_textarea which);
void toolbar_set_throbber_state(struct s_toolbar *tb, bool active);
diff --git a/atari/treeview.c b/atari/treeview.c
index e865de5..0aedb4c 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -75,7 +75,7 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- NSTREEVIEW tv = (NSTREEVIEW) guiwin_get_user_data(win);
+ NSTREEVIEW tv = (NSTREEVIEW) gemtk_wm_get_user_data(win);
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
// handle message
@@ -142,13 +142,13 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
short msg[8])
{
GRECT work, clip;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( tv == NULL )
return;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
clip = work;
if ( !rc_intersect( (GRECT*)&msg[4], &clip ) ) return;
@@ -174,15 +174,15 @@ static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
short msg[8])
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
GRECT work;
short mx, my;
if(tv == NULL)
return;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
mx = ev_out->emo_mouse.p_x;
my = ev_out->emo_mouse.p_y;
@@ -261,9 +261,9 @@ static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT
*ev_out,
}
NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func)
+ gemtk_wm_event_handler_f user_func)
{
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( win == NULL )
return( NULL );
@@ -279,10 +279,10 @@ NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
new->window = win;
new->user_func = user_func;
- guiwin_set_event_handler(win, handle_event);
- guiwin_set_user_data(win, (void*)new);
+ gemtk_wm_set_event_handler(win, handle_event);
+ gemtk_wm_set_user_data(win, (void*)new);
- slid = guiwin_get_scroll_info(new->window);
+ slid = gemtk_wm_get_scroll_info(new->window);
slid->y_unit_px = 16;
slid->x_unit_px = 16;
@@ -292,14 +292,17 @@ NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
void atari_treeview_open( NSTREEVIEW tv )
{
if( tv->window != NULL ) {
+ gemtk_wm_link(tv->window);
tree_set_redraw(tv->tree, true);
+
}
}
-void atari_treeview_close( NSTREEVIEW tv )
+void atari_treeview_close(NSTREEVIEW tv)
{
- if( tv->window != NULL ) {
+ if(tv->window != NULL) {
tree_set_redraw(tv->tree, false);
+ gemtk_wm_unlink(tv->window);
}
}
@@ -319,13 +322,13 @@ void atari_treeview_destroy( NSTREEVIEW tv )
bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
{
GRECT work;
- struct guiwin_scroll_info_s *slid;
+ struct gemtk_wm_scroll_info_s *slid;
if( tv == NULL )
return ( false );
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px);
int ry = (y-work.g_y)+(slid->y_pos*slid->y_unit_px);
@@ -340,18 +343,18 @@ bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms,
int x, int y
-void atari_treeview_redraw( NSTREEVIEW tv)
+void atari_treeview_redraw(NSTREEVIEW tv)
{
if (tv != NULL) {
if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
short todo[4];
GRECT work;
- short handle = guiwin_get_handle(tv->window);
- struct guiwin_scroll_info_s *slid;
+ short handle = gemtk_wm_get_handle(tv->window);
+ struct gemtk_wm_scroll_info_s *slid;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
- slid = guiwin_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
struct redraw_context ctx = {
.interactive = true,
@@ -468,13 +471,13 @@ void atari_treeview_resized(struct tree *tree, int width, int
height, void *pw)
return;
tv->extent.x = width;
tv->extent.y = height;
- struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area);
+ struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(tv->window);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &area);
slid->x_units = (width/slid->x_unit_px);
slid->y_units = (height/slid->y_unit_px);
/*printf("units content: %d, units viewport: %d\n",
(height/slid->y_unit_px),
(area.g_h/slid->y_unit_px));*/
- guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
+ gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER);
}
}
@@ -498,10 +501,10 @@ static void atari_treeview_get_grect(NSTREEVIEW tv, enum
treeview_area_e mode,
{
if (mode == TREEVIEW_AREA_CONTENT) {
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, dest);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
}
else if (mode == TREEVIEW_AREA_TOOLBAR) {
- guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, dest);
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, dest);
}
}
diff --git a/atari/treeview.h b/atari/treeview.h
index 19b7730..664b3a4 100755
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -36,13 +36,13 @@ struct atari_treeview
POINT extent;
POINT click;
POINT startdrag;
- guiwin_event_handler_f user_func;
+ gemtk_wm_event_handler_f user_func;
};
typedef struct atari_treeview * NSTREEVIEW;
NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func);
+ gemtk_wm_event_handler_f user_func);
void atari_treeview_destroy( NSTREEVIEW tv );
void atari_treeview_open( NSTREEVIEW tv );
void atari_treeview_close( NSTREEVIEW tv );
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index bcd9943..709795b 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -812,13 +812,13 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold,
BMessage *m
break;
}
case B_COPY:
- gui_copy_to_clipboard(browser_window_get_selection(bw));
+ browser_window_key_press(bw, KEY_COPY_SELECTION);
break;
case B_CUT:
- browser_window_key_press(bw, 24);
+ browser_window_key_press(bw, KEY_CUT_SELECTION);
break;
case B_PASTE:
- gui_paste_from_clipboard(scaffold->top_level, 0, 0);
+ browser_window_key_press(bw, KEY_PASTE);
break;
case B_SELECT_ALL:
LOG(("Selecting all text"));
diff --git a/beos/window.cpp b/beos/window.cpp
index f26ba91..d187e33 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -1662,12 +1662,6 @@ void gui_drag_save_selection(struct selection *s, struct gui_window
*g)
void gui_start_selection(struct gui_window *g)
{
- current_selection.Truncate(0);
- while (current_selection_textruns.ItemAt(0)) {
- text_run *run = (text_run *)current_selection_textruns.RemoveItem(0L);
- delete run;
- }
-
if (!g->view->LockLooper())
return;
@@ -1680,9 +1674,12 @@ void gui_clear_selection(struct gui_window *g)
{
}
-void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
+void gui_get_clipboard(char **buffer, size_t *length)
{
BMessage *clip;
+ *length = 0;
+ *buffer = NULL;
+
if (be_clipboard->Lock()) {
clip = be_clipboard->Data();
if (clip) {
@@ -1690,84 +1687,47 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
int32 textlen;
if (clip->FindData("text/plain", B_MIME_TYPE,
(const void **)&text, &textlen) >= B_OK) {
- browser_window_paste_text(g->bw,text,textlen,true);
+ *buffer = (char *)malloc(textlen);
+ *length = textlen;
+ memcpy(*buffer, text, textlen);
}
}
be_clipboard->Unlock();
}
}
-bool gui_empty_clipboard(void)
-{
- current_selection.Truncate(0);
- while (current_selection_textruns.ItemAt(0)) {
- text_run *run = (text_run *)current_selection_textruns.RemoveItem(0L);
- delete run;
- }
- return true;
-}
-
-bool gui_add_to_clipboard(const char *text, size_t length, bool space,
- const plot_font_style_t *fstyle)
-{
- BString s;
- BFont font;
- text_run *run = new text_run;
-
- nsbeos_style_to_font(font, fstyle);
- run->offset = current_selection.Length();
- run->font = font;
- run->color = nsbeos_rgb_colour(fstyle->foreground);
- current_selection_textruns.AddItem(run);
-
- s.SetTo(text, length);
- current_selection << s;
- if (space)
- current_selection << " ";
- return true;
-}
-
-bool gui_commit_clipboard(void)
+void gui_set_clipboard(const char *buffer, size_t length,
+ nsclipboard_styles styles[], int n_styles)
{
BMessage *clip;
- if (current_selection.Length() == 0)
- return true;
-
if (be_clipboard->Lock()) {
be_clipboard->Clear();
clip = be_clipboard->Data();
if (clip) {
- clip->AddData("text/plain", B_MIME_TYPE,
- current_selection.String(),
- current_selection.Length());
+ clip->AddData("text/plain", B_MIME_TYPE, buffer, length);
+
int arraySize = sizeof(text_run_array) +
- current_selection_textruns.CountItems() * sizeof(text_run);
+ n_styles * sizeof(text_run);
text_run_array *array = (text_run_array *)malloc(arraySize);
- array->count = current_selection_textruns.CountItems();
- for (int i = 0; i < array->count; i++)
- memcpy(&array->runs[i], current_selection_textruns.ItemAt(i),
- sizeof(text_run));
+ array->count = n_styles;
+ for (int i = 0; i < n_styles; i++) {
+ BFont font;
+ nsbeos_style_to_font(font, &styles[i].style);
+ array->runs[i].offset = styles[i].start;
+ array->runs[i].font = font;
+ array->runs[i].color =
+ nsbeos_rgb_colour(styles[i].style.foreground);
+ }
clip->AddData("application/x-vnd.Be-text_run_array", B_MIME_TYPE,
array, arraySize);
free(array);
-
- gui_empty_clipboard();
be_clipboard->Commit();
}
be_clipboard->Unlock();
}
- return true;
}
-bool gui_copy_to_clipboard(struct selection *s)
-{
- if (s->defined && selection_copy_to_clipboard(s))
- gui_commit_clipboard();
- return true;
-}
-
-
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
diff --git a/desktop/mouse.h b/desktop/mouse.h
index 42603a6..042db23 100644
--- a/desktop/mouse.h
+++ b/desktop/mouse.h
@@ -28,8 +28,12 @@
/* Mouse state. 1 is primary mouse button (e.g. Select on RISC OS).
* 2 is secondary mouse button (e.g. Adjust on RISC OS). */
typedef enum {
- BROWSER_MOUSE_PRESS_1 = 1, /* button 1 pressed */
- BROWSER_MOUSE_PRESS_2 = 2, /* button 2 pressed */
+ BROWSER_MOUSE_HOVER = 0, /* No mouse buttons pressed,
+ * May be used to indicate
+ * hover or end of drag. */
+
+ BROWSER_MOUSE_PRESS_1 = (1 << 0), /* button 1 pressed */
+ BROWSER_MOUSE_PRESS_2 = (1 << 1), /* button 2 pressed */
/* note: click meaning is different for
* different front ends. On RISC OS, it
@@ -40,27 +44,29 @@ typedef enum {
* click is fired when the mouse button
* is released, if the operation wasn't
* a drag. */
- BROWSER_MOUSE_CLICK_1 = 4, /* button 1 clicked. */
- BROWSER_MOUSE_CLICK_2 = 8, /* button 2 clicked. */
- BROWSER_MOUSE_DOUBLE_CLICK = 16, /* button 1 double clicked */
+ BROWSER_MOUSE_CLICK_1 = (1 << 2), /* button 1 clicked. */
+ BROWSER_MOUSE_CLICK_2 = (1 << 3), /* button 2 clicked. */
+
+ BROWSER_MOUSE_DOUBLE_CLICK = (1 << 4), /* button 1 double clicked */
- BROWSER_MOUSE_DRAG_1 = 32, /* start of button 1 drag operation */
- BROWSER_MOUSE_DRAG_2 = 64, /* start of button 2 drag operation */
+ BROWSER_MOUSE_DRAG_1 = (1 << 5), /* start of button 1 drag */
+ BROWSER_MOUSE_DRAG_2 = (1 << 6), /* start of button 2 drag */
- BROWSER_MOUSE_DRAG_ON = 128, /* a drag operation was started and
- * a mouse button is still pressed */
+ BROWSER_MOUSE_DRAG_ON = (1 << 7), /* a drag operation was started
+ * and a mouse button is still
+ * pressed */
- BROWSER_MOUSE_HOLDING_1 = 256, /* while button 1 drag is in progress */
- BROWSER_MOUSE_HOLDING_2 = 512, /* while button 2 drag is in progress */
+ BROWSER_MOUSE_HOLDING_1 = (1 << 8), /* during button 1 drag */
+ BROWSER_MOUSE_HOLDING_2 = (1 << 9), /* during button 2 drag */
- BROWSER_MOUSE_MOD_1 = 1024, /* primary modifier key pressed
- * (eg. Shift) */
- BROWSER_MOUSE_MOD_2 = 2048, /* secondary modifier key pressed
- * (eg. Ctrl) */
- BROWSER_MOUSE_MOD_3 = 4096 /* secondary modifier key pressed
- * (eg. Alt) */
+ BROWSER_MOUSE_MOD_1 = (1 << 10), /* 1st modifier key pressed
+ * (eg. Shift) */
+ BROWSER_MOUSE_MOD_2 = (1 << 11), /* 2nd modifier key pressed
+ * (eg. Ctrl) */
+ BROWSER_MOUSE_MOD_3 = (1 << 12) /* 3rd modifier key pressed
+ * (eg. Alt) */
} browser_mouse_state;
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 31effdc..2c7b748 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -29,30 +29,13 @@
#include "desktop/textarea.h"
#include "desktop/textinput.h"
#include "desktop/plotters.h"
+#include "desktop/scrollbar.h"
#include "render/font.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
-#define MARGIN_LEFT 4
-#define MARGIN_RIGHT 4
#define CARET_COLOR 0x0000FF
-/* background color for readonly textarea */
-#define READONLY_BG 0xD9D9D9
-#define BACKGROUND_COL 0xFFFFFF
-#define BORDER_COLOR 0x000000
-#define SELECTION_COL 0xFFDDDD
-
-static plot_style_t pstyle_fill_selection = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = SELECTION_COL,
-};
-
-static plot_style_t pstyle_stroke_border = {
- .stroke_type = PLOT_OP_TYPE_SOLID,
- .stroke_colour = BORDER_COLOR,
- .stroke_width = 1,
-};
static plot_style_t pstyle_stroke_caret = {
.stroke_type = PLOT_OP_TYPE_SOLID,
@@ -64,47 +47,65 @@ struct line_info {
unsigned int b_start; /**< Byte offset of line start */
unsigned int b_length; /**< Byte length of line */
};
+struct textarea_drag {
+ textarea_drag_type type;
+ union {
+ struct scrollbar* scrollbar;
+ } data;
+};
struct textarea {
- int scroll_x, scroll_y; /**< scroll offsets of the textarea
- * content
- */
+ int scroll_x, scroll_y; /**< scroll offsets for the textarea */
+
+ struct scrollbar *bar_x; /**< Horizontal scroll. */
+ struct scrollbar *bar_y; /**< Vertical scroll. */
unsigned int flags; /**< Textarea flags */
int vis_width; /**< Visible width, in pixels */
int vis_height; /**< Visible height, in pixels */
+ int pad_top; /**< Top padding, inside border, in pixels */
+ int pad_right; /**< Right padding, inside border, in pixels */
+ int pad_bottom; /**< Bottom padding, inside border, in pixels */
+ int pad_left; /**< Left padding, inside border, in pixels */
+
+ int border_width; /**< Border width, in pixels */
+ colour border_col; /**< Border colour */
+
+ plot_font_style_t fstyle; /**< Text style, inc. textarea bg col */
+ plot_font_style_t sel_fstyle; /**< Selected text style */
+
char *text; /**< UTF-8 text */
unsigned int text_alloc; /**< Size of allocated text */
unsigned int text_len; /**< Length of text, in bytes */
unsigned int text_utf8_len; /**< Length of text, in characters
- * without the trailing NUL */
+ * without the trailing NULL */
struct {
int line; /**< Line caret is on */
- int char_off; /**< Character index of caret within the
- * specified line */
+ int char_off; /**< Character index of caret on line */
} caret_pos;
int caret_x; /**< cached X coordinate of the caret */
int caret_y; /**< cached Y coordinate of the caret */
- int sel_start; /**< Character index of sel start(inclusive) */
- int sel_end; /**< Character index of sel end(exclusive) */
-
- plot_font_style_t fstyle; /**< Text style */
+ int sel_start; /**< Character index of sel start (inclusive) */
+ int sel_end; /**< Character index of sel end (exclusive) */
+ int h_extent; /**< Width of content in px */
+ int v_extent; /**< Height of content in px */
int line_count; /**< Count of lines */
#define LINE_CHUNK_SIZE 16
struct line_info *lines; /**< Line info array */
int line_height; /**< Line height obtained from style */
/** Callback function for a redraw request */
- textarea_redraw_request_callback redraw_request;
+ textarea_client_callback callback;
- void *data; /** < Callback data for both callback functions */
+ void *data; /**< Client data for callback */
- int drag_start_char; /**< Character index of drag start */
+ int drag_start_char; /**< Character index of drag start */
+ struct textarea_drag drag_info; /**< Drag information */
};
@@ -161,6 +162,7 @@ static void textarea_normalise_text(struct textarea *ta,
static bool textarea_select(struct textarea *ta, int c_start, int c_end)
{
int swap;
+ struct textarea_msg msg;
/* Ensure start is the beginning of the selection */
if (c_start > c_end) {
@@ -169,10 +171,20 @@ static bool textarea_select(struct textarea *ta, int c_start, int
c_end)
c_end = swap;
}
+ if (ta->sel_start == c_start && ta->sel_end == c_end)
+ return true;
+
ta->sel_start = c_start;
ta->sel_end = c_end;
- ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height);
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = 0;
+ msg.data.redraw.y0 = 0;
+ msg.data.redraw.x1 = ta->vis_width;
+ msg.data.redraw.y1 = ta->vis_height;
+
+ ta->callback(ta->data, &msg);
return true;
}
@@ -237,51 +249,79 @@ static bool textarea_select_fragment(struct textarea * ta)
*/
static bool textarea_scroll_visible(struct textarea *ta)
{
- int x0, x1, y0, y1, x, y;
- int index, b_off;
+ int x0, x1, y0, y1; /* area we want caret inside */
+ int xc, yc; /* area centre */
+ int x, y; /* caret pos */
+ int xs = ta->scroll_x;
+ int ys = ta->scroll_y;
bool scrolled = false;
if (ta->caret_pos.char_off == -1)
return false;
- x0 = MARGIN_LEFT;
- x1 = ta->vis_width - MARGIN_RIGHT;
+ x0 = ta->border_width + ta->pad_left;
+ x1 = ta->vis_width - (ta->border_width + ta->pad_right);
y0 = 0;
- y1 = ta->vis_height;
-
- index = textarea_get_caret(ta);
-
- /* find byte offset of caret position */
- for (b_off = 0; index-- > 0;
- b_off = utf8_next(ta->text, ta->text_len, b_off))
- ; /* do nothing */
-
- nsfont.font_width(&ta->fstyle,
- ta->text + ta->lines[ta->caret_pos.line].b_start,
- b_off - ta->lines[ta->caret_pos.line].b_start,
- &x);
-
- /* top-left of caret */
- x += MARGIN_LEFT - ta->scroll_x;
- y = ta->line_height * ta->caret_pos.line - ta->scroll_y;
+ y1 = ta->vis_height - 2 * ta->border_width -
+ ta->pad_top - ta->pad_bottom;
+ xc = (x1 - x0) / 2 + x0;
+ yc = (y1 - y0) / 2 + y0;
+
+ x = ta->caret_x - xs;
+ y = ta->caret_y + ta->line_height / 2 - ys;
+
+ /* horizontal scroll; centre caret */
+ xs += x - xc;
+
+ /* force back into range */
+ if (xs < 0)
+ xs = 0;
+ else if (xs > ta->h_extent - (x1 - x0))
+ xs = ta->h_extent - (x1 - x0);
+
+ /* If scrolled, set new pos. */
+ if (xs != ta->scroll_x && ta->bar_x != NULL) {
+ scrollbar_set(ta->bar_x, xs, false);
+ xs = scrollbar_get_offset(ta->bar_x);
+ if (xs != ta->scroll_x) {
+ ta->scroll_x = xs;
+ scrolled = true;
+ }
- /* check and change vertical scroll */
- if (y < y0) {
- ta->scroll_y -= y0 - y;
+ } else if (ta->flags & TEXTAREA_MULTILINE && ta->bar_x == NULL
&&
+ ta->scroll_x != 0) {
+ ta->scroll_x = 0;
scrolled = true;
- } else if (y + ta->line_height > y1) {
- ta->scroll_y += y + ta->line_height - y1;
+
+ } else if (xs != ta->scroll_x && !(ta->flags & TEXTAREA_MULTILINE)) {
+ ta->scroll_x = xs;
scrolled = true;
}
+ /* check and change vertical scroll */
+ if (ta->flags & TEXTAREA_MULTILINE) {
+ /* vertical scroll; centre caret */
+ ys += y - yc;
+
+ /* force back into range */
+ if (ys < 0)
+ ys = 0;
+ else if (ys > ta->v_extent - (y1 - y0))
+ ys = ta->v_extent - (y1 - y0);
+
+ /* If scrolled, set new pos. */
+ if (ys != ta->scroll_y && ta->bar_y != NULL) {
+ scrollbar_set(ta->bar_y, ys, false);
+ ys = scrollbar_get_offset(ta->bar_y);
+ if (ys != ta->scroll_y) {
+ ta->scroll_y = ys;
+ scrolled = true;
+ }
- /* check and change horizontal scroll */
- if (x < x0) {
- ta->scroll_x -= x0 - x ;
- scrolled = true;
- } else if (x > x1 - 1) {
- ta->scroll_x += x - (x1 - 1);
- scrolled = true;
+ } else if (ta->bar_y == NULL && ta->scroll_y != 0) {
+ ta->scroll_y = 0;
+ scrolled = true;
+ }
}
return scrolled;
@@ -289,25 +329,80 @@ static bool textarea_scroll_visible(struct textarea *ta)
/**
+ * Callback for scrollbar widget.
+ */
+static void textarea_scrollbar_callback(void *client_data,
+ struct scrollbar_msg_data *scrollbar_data)
+{
+ struct textarea *ta = client_data;
+ struct textarea_msg msg;
+
+ switch(scrollbar_data->msg) {
+ case SCROLLBAR_MSG_MOVED:
+ /* Scrolled; redraw everything */
+ ta->scroll_x = scrollbar_get_offset(ta->bar_x);
+ ta->scroll_y = scrollbar_get_offset(ta->bar_y);
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = 0;
+ msg.data.redraw.y0 = 0;
+ msg.data.redraw.x1 = ta->vis_width;
+ msg.data.redraw.y1 = ta->vis_height;
+
+ ta->callback(ta->data, &msg);
+ break;
+
+ case SCROLLBAR_MSG_SCROLL_START:
+ ta->drag_info.type = TEXTAREA_DRAG_SCROLLBAR;
+ ta->drag_info.data.scrollbar = scrollbar_data->scrollbar;
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_DRAG_REPORT;
+ msg.data.drag = ta->drag_info.type;
+
+ /* Tell client we're handling a drag */
+ ta->callback(ta->data, &msg);
+ break;
+
+ case SCROLLBAR_MSG_SCROLL_FINISHED:
+ ta->drag_info.type = TEXTAREA_DRAG_NONE;
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_DRAG_REPORT;
+ msg.data.drag = ta->drag_info.type;
+
+ /* Tell client we finished handling the drag */
+ ta->callback(ta->data, &msg);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+
+/**
* Reflow a text area from the given line onwards
*
* \param ta Text area to reflow
- * \param line Line number to begin reflow on
+ * \param start Line number to begin reflow on
* \return true on success false otherwise
*/
-static bool textarea_reflow(struct textarea *ta, unsigned int line)
+static bool textarea_reflow(struct textarea *ta, unsigned int start)
{
char *text;
unsigned int len;
size_t b_off;
int x;
- char *space;
- unsigned int line_count = 0;
-
- /** \todo pay attention to line parameter */
- /** \todo create horizontal scrollbar if needed */
-
- ta->line_count = 0;
+ char *space, *para_end;
+ unsigned int line; /* line count */
+ unsigned int scroll_lines;
+ int avail_width;
+ int h_extent; /* horizontal extent */
+ int v_extent; /* vertical extent */
+ bool restart;
if (ta->lines == NULL) {
ta->lines =
@@ -320,71 +415,190 @@ static bool textarea_reflow(struct textarea *ta, unsigned int
line)
if (!(ta->flags & TEXTAREA_MULTILINE)) {
/* Single line */
- ta->lines[line_count].b_start = 0;
- ta->lines[line_count++].b_length = ta->text_len - 1;
+ int w = ta->vis_width - 2 * ta->border_width -
+ ta->pad_left - ta->pad_right;
+ ta->lines[0].b_start = 0;
+ ta->lines[0].b_length = ta->text_len - 1;
- ta->line_count = line_count;
+ nsfont.font_width(&ta->fstyle, ta->text, ta->text_len, &x);
+ if (x > w)
+ w = x;
+ ta->h_extent = w + ta->pad_left - ta->pad_right;
+ ta->line_count = 1;
return true;
}
- for (len = ta->text_len - 1, text = ta->text; len > 0;
- len -= b_off, text += b_off) {
+ /* Find max number of lines before vertical scrollbar is required */
+ scroll_lines = (ta->vis_height - 2 * ta->border_width -
+ ta->pad_top - ta->pad_bottom) /
+ ta->line_height;
+
+ if ((signed)start > ta->line_count)
+ start = 0;
+ /** \todo pay attention to start param, for now force start at zero */
+ start = 0;
+
+ do {
+ /* Set line count to start point */
+ line = start;
+
+ /* Find available width */
+ avail_width = ta->vis_width - 2 * ta->border_width -
+ ta->pad_left - ta->pad_right;
+ if (avail_width < 0)
+ avail_width = 0;
+ h_extent = avail_width;
+
+ restart = false;
+ for (len = ta->text_len - 1, text = ta->text; len > 0;
+ len -= b_off, text += b_off) {
+
+ /* Find end of paragraph */
+ for (para_end = text; para_end < text + len;
+ para_end++) {
+ if (*para_end == '\n')
+ break;
+ }
- nsfont.font_split(&ta->fstyle, text, len,
- ta->vis_width - MARGIN_LEFT - MARGIN_RIGHT,
- &b_off, &x);
+ /* Wrap current line in paragraph */
+ nsfont.font_split(&ta->fstyle, text, para_end - text,
+ avail_width, &b_off, &x);
+ /* b_off now marks space, or end of paragraph */
- if (line_count > 0 && line_count % LINE_CHUNK_SIZE == 0) {
- struct line_info *temp = realloc(ta->lines,
- (line_count + LINE_CHUNK_SIZE) *
- sizeof(struct line_info));
- if (temp == NULL) {
- LOG(("realloc failed"));
- return false;
+ if (x > h_extent) {
+ h_extent = x;
+ }
+ if (x > avail_width && ta->bar_x == NULL) {
+ /* We need to insert a horizontal scrollbar */
+ int w = ta->vis_width - 2 * ta->border_width;
+ if (!scrollbar_create(true, w, w, w,
+ ta, textarea_scrollbar_callback,
+ &(ta->bar_x)))
+ return false;
+ if (ta->bar_y != NULL)
+ scrollbar_make_pair(ta->bar_x,
+ ta->bar_y);
+ ta->pad_bottom += SCROLLBAR_WIDTH;
+
+ /* Find new max visible lines */
+ scroll_lines = (ta->vis_height -
+ 2 * ta->border_width -
+ ta->pad_top - ta->pad_bottom) /
+ ta->line_height;
}
- ta->lines = temp;
- }
+ if (line > 0 && line % LINE_CHUNK_SIZE == 0) {
+ struct line_info *temp = realloc(ta->lines,
+ (line + LINE_CHUNK_SIZE) *
+ sizeof(struct line_info));
+ if (temp == NULL) {
+ LOG(("realloc failed"));
+ return false;
+ }
- /* handle LF */
- for (space = text; space <= text + b_off; space++) {
- if (*space == '\n')
- break;
- }
+ ta->lines = temp;
+ }
+
+ if (para_end == text + b_off && *para_end == '\n') {
+ /* Not found any spaces to wrap at, and we
+ * have a newline char */
+ ta->lines[line].b_start = text - ta->text;
+ ta->lines[line++].b_length = para_end - text;
+
+ /* Jump newline */
+ b_off++;
+
+ if (len - b_off == 0) {
+ /* reached end of input;
+ * add last line */
+ ta->lines[line].b_start =
+ text + b_off - ta->text;
+ ta->lines[line++].b_length = 0;
+ }
- if (space <= text + b_off) {
- /* Found newline; use it */
- ta->lines[line_count].b_start = text - ta->text;
- ta->lines[line_count++].b_length = space - text;
+ if (line > scroll_lines && ta->bar_y == NULL)
+ break;
- b_off = space + 1 - text;
+ continue;
- if (len - b_off == 0) {
- /* reached end of input => add last line */
- ta->lines[line_count].b_start =
- text + b_off - ta->text;
- ta->lines[line_count++].b_length = 0;
+ } else if (len - b_off > 0) {
+ /* soft wraped, find last space (if any) */
+ for (space = text + b_off; space > text;
+ space--) {
+ if (*space == ' ')
+ break;
+ }
+
+ if (space != text)
+ b_off = space + 1 - text;
}
- continue;
+ ta->lines[line].b_start = text - ta->text;
+ ta->lines[line++].b_length = b_off;
+
+ if (line > scroll_lines && ta->bar_y == NULL)
+ break;
}
- if (len - b_off > 0) {
- /* find last space (if any) */
- for (space = text + b_off; space > text; space--)
- if (*space == ' ')
- break;
+ if (h_extent <= avail_width && ta->bar_x != NULL) {
+ /* We need to remove a horizontal scrollbar */
+ scrollbar_destroy(ta->bar_x);
+ ta->bar_x = NULL;
+ ta->pad_bottom -= SCROLLBAR_WIDTH;
- if (space != text)
- b_off = space + 1 - text;
+ /* Find new max visible lines */
+ scroll_lines = (ta->vis_height - 2 * ta->border_width -
+ ta->pad_top - ta->pad_bottom) /
+ ta->line_height;
}
- ta->lines[line_count].b_start = text - ta->text;
- ta->lines[line_count++].b_length = b_off;
+ if (line > scroll_lines && ta->bar_y == NULL) {
+ /* Add vertical scrollbar */
+ int h = ta->vis_height - 2 * ta->border_width;
+ if (!scrollbar_create(false, h, h, h,
+ ta, textarea_scrollbar_callback,
+ &(ta->bar_y)))
+ return false;
+ if (ta->bar_x != NULL)
+ scrollbar_make_pair(ta->bar_x,
+ ta->bar_y);
+ ta->pad_right += SCROLLBAR_WIDTH;
+ restart = true;
+
+ } else if (line <= scroll_lines && ta->bar_y != NULL) {
+ /* Remove vertical scrollbar */
+ scrollbar_destroy(ta->bar_y);
+ ta->bar_y = NULL;
+ ta->pad_right -= SCROLLBAR_WIDTH;
+ restart = true;
+ }
+ } while (restart);
+
+ h_extent += ta->pad_left + ta->pad_right -
+ (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0);
+ v_extent = line * ta->line_height + ta->pad_top +
+ ta->pad_bottom -
+ (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0);
+
+ if (ta->bar_x != NULL) {
+ /* Set horizontal scrollbar extents */
+ int w = ta->vis_width - 2 * ta->border_width -
+ (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0);
+ scrollbar_set_extents(ta->bar_x, w, w, h_extent);
}
- ta->line_count = line_count;
+ if (ta->bar_y != NULL) {
+ /* Set vertical scrollbar extents */
+ int h = ta->vis_height - 2 * ta->border_width;
+ scrollbar_set_extents(ta->bar_y, h,
+ h - (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0),
+ v_extent);
+ }
+
+ ta->h_extent = h_extent;
+ ta->v_extent = v_extent;
+ ta->line_count = line;
return true;
}
@@ -411,8 +625,8 @@ static void textarea_get_xy_offset(struct textarea *ta, int x, int y,
return;
}
- x = x - MARGIN_LEFT + ta->scroll_x;
- y = y + ta->scroll_y;
+ x = x - ta->border_width - ta->pad_left + ta->scroll_x;
+ y = y - ta->border_width - ta->pad_top + ta->scroll_y;
if (x < 0)
x = 0;
@@ -602,7 +816,7 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int
start,
/* Insert new text */
memcpy(ta->text + b_start, rep, rep_len);
- ta->text_len += rep_len - (b_end - b_start);
+ ta->text_len += (int)rep_len - (b_end - b_start);
ta->text_utf8_len = utf8_length(ta->text);
textarea_normalise_text(ta, b_start, rep_len);
@@ -611,16 +825,80 @@ static bool textarea_replace_text(struct textarea *ta, unsigned int
start,
}
+/**
+ * Handles the end of a drag operation
+ *
+ * \param ta Text area
+ * \param mouse the mouse state at drag end moment
+ * \param x X coordinate
+ * \param y Y coordinate
+ * \return true if drag end was handled false otherwise
+ */
+static bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
+ int x, int y)
+{
+ int c_end;
+ size_t b_off;
+ unsigned int c_off;
+ struct textarea_msg msg;
+
+ assert(ta->drag_info.type != TEXTAREA_DRAG_NONE);
+
+ switch (ta->drag_info.type) {
+ case TEXTAREA_DRAG_SCROLLBAR:
+ if (ta->drag_info.data.scrollbar == ta->bar_x) {
+ x -= ta->border_width;
+ y -= ta->vis_height - ta->border_width -
+ SCROLLBAR_WIDTH;
+ } else {
+ x -= ta->vis_width - ta->border_width -
+ SCROLLBAR_WIDTH;
+ y -= ta->border_width;
+ }
+ scrollbar_mouse_drag_end(ta->drag_info.data.scrollbar,
+ mouse, x, y);
+ assert(ta->drag_info.type == TEXTAREA_DRAG_NONE);
+
+ /* Return, since drag end already reported to textarea client */
+ return true;
+
+ case TEXTAREA_DRAG_SELECTION:
+ ta->drag_info.type = TEXTAREA_DRAG_NONE;
+
+ textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
+ c_end = c_off;
+
+ if (!textarea_select(ta, ta->drag_start_char, c_end))
+ return false;
+
+ break;
+
+ default:
+ return false;
+ }
+
+ /* Report drag end to client, if not already reported */
+ assert(ta->drag_info.type == TEXTAREA_DRAG_NONE);
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_DRAG_REPORT;
+ msg.data.drag = ta->drag_info.type;
+
+ ta->callback(ta->data, &msg);
+
+ return true;
+}
+
+
/* exported interface, documented in textarea.h */
-struct textarea *textarea_create(int width, int height,
- textarea_flags flags, const plot_font_style_t *style,
- textarea_redraw_request_callback redraw_request, void *data)
+struct textarea *textarea_create(const textarea_setup *setup,
+ textarea_client_callback callback, void *data)
{
struct textarea *ret;
- if (redraw_request == NULL) {
+ if (callback == NULL) {
LOG(("no callback provided"));
return NULL;
}
@@ -631,16 +909,35 @@ struct textarea *textarea_create(int width, int height,
return NULL;
}
- ret->redraw_request = redraw_request;
+ ret->callback = callback;
ret->data = data;
- ret->vis_width = width;
- ret->vis_height = height;
+
+ ret->flags = setup->flags;
+ ret->vis_width = setup->width;
+ ret->vis_height = setup->height;
+
+ ret->pad_top = setup->pad_top;
+ ret->pad_right = setup->pad_right;
+ ret->pad_bottom = setup->pad_bottom;
+ ret->pad_left = setup->pad_left;
+
+ ret->border_width = setup->border_width;
+ ret->border_col = setup->border_col;
+
+ ret->fstyle = setup->text;
+
+ ret->sel_fstyle = setup->text;
+ ret->sel_fstyle.foreground = setup->selected_text;
+ ret->sel_fstyle.background = setup->selected_bg;
+
ret->scroll_x = 0;
ret->scroll_y = 0;
+ ret->bar_x = NULL;
+ ret->bar_y = NULL;
ret->drag_start_char = 0;
+ ret->drag_info.type = TEXTAREA_DRAG_NONE;
- ret->flags = flags;
ret->text = malloc(64);
if (ret->text == NULL) {
LOG(("malloc failed"));
@@ -652,14 +949,13 @@ struct textarea *textarea_create(int width, int height,
ret->text_len = 1;
ret->text_utf8_len = 0;
- ret->fstyle = *style;
-
ret->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2),
FMUL(nscss_screen_dpi,
- INTTOFIX((style->size / FONT_SIZE_SCALE))))), F_72));
+ INTTOFIX((setup->text.size /
+ FONT_SIZE_SCALE))))), F_72));
- ret->caret_pos.line = ret->caret_pos.char_off = 0;
- ret->caret_x = MARGIN_LEFT;
+ ret->caret_pos.line = ret->caret_pos.char_off = -1;
+ ret->caret_x = 0;
ret->caret_y = 0;
ret->sel_start = -1;
ret->sel_end = -1;
@@ -674,6 +970,10 @@ struct textarea *textarea_create(int width, int height,
/* exported interface, documented in textarea.h */
void textarea_destroy(struct textarea *ta)
{
+ if (ta->bar_x)
+ scrollbar_destroy(ta->bar_x);
+ if (ta->bar_y)
+ scrollbar_destroy(ta->bar_y);
free(ta->text);
free(ta->lines);
free(ta);
@@ -738,6 +1038,7 @@ bool textarea_set_caret(struct textarea *ta, int caret)
int x0, y0, x1, y1;
int text_y_offset;
int width, height;
+ struct textarea_msg msg;
if (ta->flags & TEXTAREA_READONLY)
return true;
@@ -749,48 +1050,28 @@ bool textarea_set_caret(struct textarea *ta, int caret)
if (ta->flags & TEXTAREA_MULTILINE) {
/* Multiline textarea */
- text_y_offset = 0;
+ text_y_offset = ta->border_width + ta->pad_top;
} else {
/* Single line text area; text is vertically centered */
- text_y_offset = (ta->vis_height - ta->line_height + 1) / 2;
+ text_y_offset = ta->border_width;
+ text_y_offset += (ta->vis_height - ta->line_height + 1) / 2;
}
/* Delete the old caret */
if (ta->caret_pos.char_off != -1) {
- index = textarea_get_caret(ta);
- if (index == -1)
- return false;
-
- /* the redraw might happen in response to a text-change and
- the caret position might be beyond the current text */
- if ((unsigned)index > c_len)
- index = c_len;
-
- /* find byte offset of caret position */
- for (b_off = 0; index-- > 0;
- b_off = utf8_next(ta->text,
- ta->text_len, b_off))
- ; /* do nothing */
-
- nsfont.font_width(&ta->fstyle,
- ta->text +
- ta->lines[ta->caret_pos.line].b_start,
- b_off - ta->lines[ta->caret_pos.line].b_start,
- &x);
-
- x += MARGIN_LEFT - ta->scroll_x;
-
- y = ta->line_height * ta->caret_pos.line - ta->scroll_y;
-
- /* set the caret coordinate beyond the redraw rectangle */
- ta->caret_x = x - 2;
-
- x0 = x - 1;
- y0 = y + text_y_offset;
+ x0 = ta->caret_x - ta->scroll_x;
+ y0 = ta->caret_y + text_y_offset - ta->scroll_y;
width = 2;
height = ta->line_height;
- ta->redraw_request(ta->data, x0, y0, width, height);
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = x0;
+ msg.data.redraw.y0 = y0;
+ msg.data.redraw.x1 = x0 + width;
+ msg.data.redraw.y1 = y0 + height;
+
+ ta->callback(ta->data, &msg);
}
/* check if the caret has to be drawn at all */
@@ -831,19 +1112,18 @@ bool textarea_set_caret(struct textarea *ta, int caret)
b_off - ta->lines[ta->caret_pos.line].b_start,
&x);
- x += MARGIN_LEFT - ta->scroll_x;
+ x += ta->border_width + ta->pad_left;
ta->caret_x = x;
- y = ta->line_height * ta->caret_pos.line - ta->scroll_y;
+ y = ta->line_height * ta->caret_pos.line;
ta->caret_y = y;
- if (textarea_scroll_visible(ta)) {
- ta->redraw_request(ta->data, 0, 0,
- ta->vis_width,
- ta->vis_height);
- } else {
- x0 = max(x - 1, MARGIN_LEFT);
+ if (!textarea_scroll_visible(ta)) {
+ /* No scroll, just caret moved, redraw it */
+ x -= ta->scroll_x;
+ y -= ta->scroll_y;
+ x0 = max(x - 1, ta->border_width);
y0 = max(y + text_y_offset, 0);
- x1 = min(x + 1, ta->vis_width - MARGIN_RIGHT);
+ x1 = min(x + 1, ta->vis_width - ta->border_width);
y1 = min(y + ta->line_height + text_y_offset,
ta->vis_height);
@@ -851,8 +1131,14 @@ bool textarea_set_caret(struct textarea *ta, int caret)
height = y1 - y0;
if (width > 0 && height > 0) {
- ta->redraw_request(ta->data, x0, y0,
- width, height);
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = x0;
+ msg.data.redraw.y0 = y0;
+ msg.data.redraw.x1 = x0 + width;
+ msg.data.redraw.y1 = y0 + height;
+
+ ta->callback(ta->data, &msg);
}
}
}
@@ -866,6 +1152,9 @@ int textarea_get_caret(struct textarea *ta)
{
unsigned int c_off = 0, b_off;
+ /* Ensure caret isn't hidden */
+ if (ta->caret_pos.char_off < 0)
+ textarea_set_caret(ta, 0);
/* if the text is a trailing NUL only */
if (ta->text_utf8_len == 0)
@@ -881,19 +1170,26 @@ int textarea_get_caret(struct textarea *ta)
/* exported interface, documented in textarea.h */
-void textarea_redraw(struct textarea *ta, int x, int y,
+void textarea_redraw(struct textarea *ta, int x, int y, colour bg,
const struct rect *clip, const struct redraw_context *ctx)
{
+ struct textarea_msg msg;
const struct plotter_table *plot = ctx->plot;
- int line0, line1, line;
- int chars, offset, text_y_offset, text_y_offset_baseline;
- unsigned int c_pos, c_len, b_start, b_end, line_len;
+ int line0, line1, line, left, right;
+ int chars, text_y_offset, text_y_offset_baseline;
+ unsigned int c_pos, c_len, c_len_part, b_start, b_end, line_len;
+ unsigned int sel_start, sel_end;
char *line_text;
- struct rect r;
- plot_style_t plot_style_fill_bg = {
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = BACKGROUND_COL,
- };
+ struct rect r, s;
+ bool selected = false;
+ plot_font_style_t *fstyle;
+ plot_style_t plot_style_fill_bg = {
+ .stroke_type = PLOT_OP_TYPE_NONE,
+ .stroke_width = 0,
+ .stroke_colour = NS_TRANSPARENT,
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = ta->border_col
+ };
r = *clip;
@@ -906,9 +1202,6 @@ void textarea_redraw(struct textarea *ta, int x, int y,
/* Nothing to redraw */
return;
- if (ta->flags & TEXTAREA_READONLY)
- plot_style_fill_bg.fill_colour = READONLY_BG;
-
line0 = (r.y0 - y + ta->scroll_y) / ta->line_height - 1;
line1 = (r.y1 - y + ta->scroll_y) / ta->line_height + 1;
@@ -933,145 +1226,213 @@ void textarea_redraw(struct textarea *ta, int x, int y,
r.y1 = y + ta->vis_height;
plot->clip(&r);
- plot->rectangle(r.x0, r.y0, r.x1, r.y1, &plot_style_fill_bg);
- plot->rectangle(x, y,
- x + ta->vis_width - 1, y + ta->vis_height - 1,
- &pstyle_stroke_border);
-
- if (r.x0 < x + MARGIN_LEFT)
- r.x0 = x + MARGIN_LEFT;
- if (r.x1 > x + ta->vis_width - MARGIN_RIGHT)
- r.x1 = x + ta->vis_width - MARGIN_RIGHT;
- plot->clip(&r);
+ if (ta->border_col != NS_TRANSPARENT &&
+ ta->border_width > 0) {
+ /* Plot border */
+ plot->rectangle(x, y, x + ta->vis_width, y + ta->vis_height,
+ &plot_style_fill_bg);
+ }
+ if (ta->fstyle.background != NS_TRANSPARENT) {
+ /* Plot background */
+ plot_style_fill_bg.fill_colour = ta->fstyle.background;
+ plot->rectangle(x + ta->border_width, y + ta->border_width,
+ x + ta->vis_width - ta->border_width,
+ y + ta->vis_height - ta->border_width,
+ &plot_style_fill_bg);
+ }
+
+ if (r.x0 < x + ta->border_width)
+ r.x0 = x + ta->border_width;
+ if (r.x1 > x + ta->vis_width - ta->border_width)
+ r.x1 = x + ta->vis_width - ta->border_width;
+ if (r.y0 < y + ta->border_width)
+ r.y0 = y + ta->border_width;
+ if (r.y1 > y + ta->vis_height - ta->border_width -
+ (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0))
+ r.y1 = y + ta->vis_height - ta->border_width -
+ (ta->bar_x != NULL ? SCROLLBAR_WIDTH : 0);
if (line0 > 0)
- c_pos = utf8_bounded_length(ta->text,
- ta->lines[line0].b_start - 1);
+ c_pos = utf8_bounded_length(ta->text, ta->lines[line0].b_start);
else
c_pos = 0;
+ text_y_offset = text_y_offset_baseline = ta->border_width;
if (ta->flags & TEXTAREA_MULTILINE) {
/* Multiline textarea */
- text_y_offset = 0;
- text_y_offset_baseline = (ta->line_height * 3 + 2) / 4;
+ text_y_offset += ta->pad_top;
+ text_y_offset_baseline += (ta->line_height * 3 + 2) / 4 +
+ ta->pad_top;
} else {
/* Single line text area; text is vertically centered */
- text_y_offset = (ta->vis_height - ta->line_height + 1) / 2;
- text_y_offset_baseline = (ta->vis_height * 3 + 2) / 4;
+ int vis_height = ta->vis_height - 2 * ta->border_width;
+ text_y_offset += (vis_height - ta->line_height + 1) / 2;
+ text_y_offset_baseline += (vis_height * 3 + 2) / 4;
}
+ plot_style_fill_bg.fill_colour = ta->sel_fstyle.background;
+
for (line = line0; (line <= line1) &&
(y + line * ta->line_height <= r.y1 + ta->scroll_y);
line++) {
if (ta->lines[line].b_length == 0)
continue;
+ /* reset clip rectangle */
+ plot->clip(&r);
+
c_len = utf8_bounded_length(
&(ta->text[ta->lines[line].b_start]),
ta->lines[line].b_length);
- /* if there is a newline between the lines count it too */
- if (line < ta->line_count - 1 && ta->lines[line + 1].b_start !=
- ta->lines[line].b_start +
- ta->lines[line].b_length)
- c_len++;
-
- /* check if a part of the line is selected, won't happen if no
- selection (ta->sel_end = -1) */
- if (ta->sel_end != -1 &&
- c_pos < (unsigned)ta->sel_end &&
- c_pos + c_len > (unsigned)ta->sel_start) {
+ b_end = 0;
+ right = x + ta->border_width + ta->pad_left - ta->scroll_x;
+
+ do {
+ sel_start = ta->sel_start;
+ sel_end = ta->sel_end;
+ /* get length of part of line */
+ if (ta->sel_end == -1 || ta->sel_end == ta->sel_start ||
+ sel_end <= c_pos ||
+ sel_start > c_pos + c_len) {
+ /* rest of line unselected */
+ selected = false;
+ c_len_part = c_len;
+ fstyle = &ta->fstyle;
+
+ } else if (sel_start <= c_pos &&
+ sel_end > c_pos + c_len) {
+ /* rest of line selected */
+ selected = true;
+ c_len_part = c_len;
+ fstyle = &ta->sel_fstyle;
+
+ } else if (sel_start > c_pos) {
+ /* next part of line unselected */
+ selected = false;
+ c_len_part = sel_start - c_pos;
+ fstyle = &ta->fstyle;
+
+ } else if (sel_end > c_pos) {
+ /* next part of line selected */
+ selected = true;
+ c_len_part = sel_end - c_pos;
+ fstyle = &ta->sel_fstyle;
- /* offset from the beginning of the line */
- offset = ta->sel_start - c_pos;
- chars = ta->sel_end - c_pos -
- (offset > 0 ? offset:0);
+ } else {
+ assert(0);
+ }
line_text = &(ta->text[ta->lines[line].b_start]);
line_len = ta->lines[line].b_length;
- if (offset > 0) {
-
- /* find byte start of the selected part */
- for (b_start = 0; offset > 0; offset--)
- b_start = utf8_next(line_text,
- line_len,
- b_start);
- nsfont.font_width(&ta->fstyle, line_text,
- b_start, &r.x0);
- r.x0 += x + MARGIN_LEFT;
- }
- else {
- r.x0 = x + MARGIN_LEFT;
- b_start = 0;
+ /* find b_start and b_end for this part of the line */
+ b_start = b_end;
+
+ chars = c_len_part;
+ for (b_end = b_start; chars > 0; chars--)
+ b_end = utf8_next(line_text, line_len, b_end);
+
+ /* find clip left/right for this part of line */
+ left = right;
+ nsfont.font_width(&ta->fstyle, line_text,
+ b_end, &right);
+ right += x + ta->border_width + ta->pad_left -
+ ta->scroll_x;
+
+ /* set clip rectangle for line part */
+ s = r;
+ if (s.x0 < left)
+ s.x0 = left;
+ if (s.x1 > right)
+ s.x1 = right;
+ plot->clip(&s);
+
+ if (selected) {
+ /* draw selection fill */
+ plot->rectangle(s.x0,
+ y + line * ta->line_height + 1 -
+ ta->scroll_y + text_y_offset,
+ s.x1,
+ y + (line + 1) * ta->line_height + 1 -
+ ta->scroll_y + text_y_offset,
+ &plot_style_fill_bg);
}
+ /* draw text */
+ plot->text(x + ta->border_width + ta->pad_left -
+ ta->scroll_x,
+ y + line * ta->line_height +
+ text_y_offset_baseline - ta->scroll_y,
+ ta->text + ta->lines[line].b_start,
+ ta->lines[line].b_length, fstyle);
+
+ c_pos += c_len_part;
+ c_len -= c_len_part;
+
+ } while (c_pos < c_pos + c_len);
+
+ /* if there is a newline between the lines, skip it */
+ if (line < ta->line_count - 1 &&
+ ta->lines[line + 1].b_start !=
+ ta->lines[line].b_start +
+ ta->lines[line].b_length)
+ c_pos++;
+ }
- if (chars >= 0) {
+ plot->clip(clip);
- /* find byte end of the selected part */
- for (b_end = b_start; chars > 0 &&
- b_end < line_len;
- chars--) {
- b_end = utf8_next(line_text, line_len,
- b_end);
- }
- }
- else
- b_end = ta->lines[line].b_length;
-
- b_end -= b_start;
- nsfont.font_width(&ta->fstyle,
- &(ta->text[ta->lines[line].b_start +
- b_start]),
- b_end, &r.x1);
- r.x1 += r.x0;
- plot->rectangle(r.x0 - ta->scroll_x, y +
- line * ta->line_height +
- 1 - ta->scroll_y + text_y_offset,
- r.x1 - ta->scroll_x,
- y + (line + 1) * ta->line_height -
- 1 - ta->scroll_y + text_y_offset,
- &pstyle_fill_selection);
+ if ((ta->sel_end == -1 || ta->sel_start == ta->sel_end) &&
+ ta->caret_pos.char_off >= 0) {
+ /* There is no selection, and caret visible: show caret */
+ int caret_y = y - ta->scroll_y + ta->caret_y + text_y_offset;
+ if (ta->flags & TEXTAREA_INTERNAL_CARET) {
+ /* Render our own caret */
+ plot->line(x - ta->scroll_x + ta->caret_x, caret_y,
+ x - ta->scroll_x + ta->caret_x,
+ caret_y + ta->line_height,
+ &pstyle_stroke_caret);
+ } else {
+ /* Tell client where caret should be placed */
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_MOVED_CARET;
+ msg.data.caret.hidden = false;
+ msg.data.caret.x = x - ta->scroll_x + ta->caret_x;
+ msg.data.caret.y = caret_y;
+ msg.data.caret.height = ta->line_height;
+
+ ta->callback(ta->data, &msg);
}
+ } else if (!(ta->flags & TEXTAREA_INTERNAL_CARET)) {
+ /* Caret hidden, and client is responsible: tell client */
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_MOVED_CARET;
+ msg.data.caret.hidden = true;
- c_pos += c_len;
-
- r.y0 = y + line * ta->line_height + text_y_offset_baseline;
-
- ta->fstyle.background =
- (ta->flags & TEXTAREA_READONLY) ?
- READONLY_BG : BACKGROUND_COL,
-
- plot->text(x + MARGIN_LEFT - ta->scroll_x,
- r.y0 - ta->scroll_y,
- ta->text + ta->lines[line].b_start,
- ta->lines[line].b_length,
- &ta->fstyle);
+ ta->callback(ta->data, &msg);
}
- if ((ta->sel_end == -1 ||
- ta->sel_start == ta->sel_end) &&
- x + ta->caret_x >= clip->x0 &&
- x + ta->caret_x <= clip->x1) {
- /* There is no selection and caret is in horizontal
- * clip range. */
- int caret_height = ta->line_height - 1;
- y += ta->caret_y + text_y_offset;
- if (y + caret_height >= clip->y0 && y <= clip->y1)
- /* Caret in vertical clip range; plot */
- plot->line(x + ta->caret_x, y + ta->caret_y,
- x + ta->caret_x,
- y + ta->caret_y + caret_height,
- &pstyle_stroke_caret);
- }
+ if (ta->bar_x != NULL)
+ scrollbar_redraw(ta->bar_x,
+ x + ta->border_width,
+ y + ta->vis_height - ta->border_width -
+ SCROLLBAR_WIDTH,
+ clip, 1.0, ctx);
+
+ if (ta->bar_y != NULL)
+ scrollbar_redraw(ta->bar_y,
+ x + ta->vis_width - ta->border_width -
+ SCROLLBAR_WIDTH,
+ y + ta->border_width,
+ clip, 1.0, ctx);
}
/* exported interface, documented in textarea.h */
bool textarea_keypress(struct textarea *ta, uint32_t key)
{
+ struct textarea_msg msg;
char utf8[6];
unsigned int caret, caret_init, length, l_len, b_off, b_len;
int c_line, c_chars, line;
@@ -1082,7 +1443,6 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
line = ta->caret_pos.line;
readonly = (ta->flags & TEXTAREA_READONLY ? true:false);
-
if (!(key <= 0x001F || (0x007F <= key && key <= 0x009F))) {
/* normal character insertion */
length = utf8_from_ucs4(key, utf8);
@@ -1110,10 +1470,10 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
case KEY_SELECT_ALL:
caret = ta->text_utf8_len;
- ta->sel_start = 0;
+ ta->sel_start = 0;
ta->sel_end = ta->text_utf8_len;
- redraw = true;
- break;
+ redraw = true;
+ break;
case KEY_COPY_SELECTION:
if (ta->sel_start != -1) {
if (!textarea_replace_text(ta,
@@ -1157,13 +1517,16 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
break;
case KEY_PASTE:
{
- if (readonly)
- break;
char *clipboard;
size_t clipboard_length;
size_t clipboard_chars;
+ if (readonly)
+ break;
+
gui_get_clipboard(&clipboard, &clipboard_length);
+ if (clipboard == NULL)
+ return false;
clipboard_chars = utf8_bounded_length(clipboard,
clipboard_length);
@@ -1336,7 +1699,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
break;
if (ta->sel_start != -1) {
if (!textarea_replace_text(ta,
- ta->sel_start,
+ ta->sel_start,
ta->sel_end, "", 0, false))
return false;
@@ -1404,7 +1767,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
break;
if (ta->sel_start != -1) {
if (!textarea_replace_text(ta,
- ta->sel_start,
+ ta->sel_start,
ta->sel_end, "", 0, false))
return false;
ta->sel_start = ta->sel_end = -1;
@@ -1424,7 +1787,7 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
break;
if (ta->sel_start != -1) {
if (!textarea_replace_text(ta,
- ta->sel_start,
+ ta->sel_start,
ta->sel_end, "", 0, false))
return false;
ta->sel_start = ta->sel_end = -1;
@@ -1446,8 +1809,14 @@ bool textarea_keypress(struct textarea *ta, uint32_t key)
textarea_set_caret(ta, caret);
//TODO:redraw only the important part
if (redraw) {
- ta->redraw_request(ta->data, 0, 0,
- ta->vis_width, ta->vis_height);
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = 0;
+ msg.data.redraw.y0 = 0;
+ msg.data.redraw.x1 = ta->vis_width;
+ msg.data.redraw.y1 = ta->vis_height;
+
+ ta->callback(ta->data, &msg);
}
return true;
@@ -1459,23 +1828,83 @@ bool textarea_mouse_action(struct textarea *ta,
browser_mouse_state mouse,
int x, int y)
{
int c_start, c_end;
+ int sx, sy; /* xy coord offset for scrollbar */
+ int sl; /* scrollbar length */
size_t b_off;
unsigned int c_off;
+ struct textarea_msg msg;
+
+ if (ta->drag_info.type != TEXTAREA_DRAG_NONE &&
+ mouse == BROWSER_MOUSE_HOVER) {
+ /* There is a drag that we must end */
+ textarea_drag_end(ta, mouse, x, y);
+ }
+
+ if (ta->drag_info.type == TEXTAREA_DRAG_SCROLLBAR) {
+ /* Scrollbar drag in progress; pass input to scrollbar */
+ if (ta->drag_info.data.scrollbar == ta->bar_x) {
+ x -= ta->border_width;
+ y -= ta->vis_height - ta->border_width -
+ SCROLLBAR_WIDTH;
+ } else {
+ x -= ta->vis_width - ta->border_width -
+ SCROLLBAR_WIDTH;
+ y -= ta->border_width;
+ }
+ scrollbar_mouse_action(ta->drag_info.data.scrollbar,
+ mouse, x, y);
+ return true;
+ }
+
+ /* Horizontal scrollbar */
+ if (ta->bar_x != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) {
+ /* No drag happening, but mouse input is over scrollbar;
+ * pass input to scrollbar */
+ sx = x - ta->border_width;
+ sy = y - (ta->vis_height - ta->border_width - SCROLLBAR_WIDTH);
+ sl = ta->vis_width - 2 * ta->border_width -
+ (ta->bar_y != NULL ? SCROLLBAR_WIDTH : 0);
+
+ if (sx >= 0 && sy >= 0 && sx < sl && sy <
SCROLLBAR_WIDTH) {
+ scrollbar_mouse_action(ta->bar_x, mouse, sx, sy);
+ return true;
+ }
+ }
+
+ /* Vertical scrollbar */
+ if (ta->bar_y != NULL && ta->drag_info.type == TEXTAREA_DRAG_NONE) {
+ /* No drag happening, but mouse input is over scrollbar;
+ * pass input to scrollbar */
+ sx = x - (ta->vis_width - ta->border_width - SCROLLBAR_WIDTH);
+ sy = y - ta->border_width;
+ sl = ta->vis_height - 2 * ta->border_width;
+
+ if (sx >= 0 && sy >= 0 && sx < SCROLLBAR_WIDTH && sy
< sl) {
+ scrollbar_mouse_action(ta->bar_y, mouse, sx, sy);
+ return true;
+ }
+ }
/* mouse button pressed above the text area, move caret */
if (mouse & BROWSER_MOUSE_PRESS_1) {
if (!(ta->flags & TEXTAREA_READONLY)) {
- textarea_set_caret_xy(ta, x, y);
-
textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
ta->drag_start_char = c_off;
+
+ textarea_set_caret(ta, c_off);
}
if (ta->sel_start != -1) {
/* remove selection */
ta->sel_start = ta->sel_end = -1;
- ta->redraw_request(ta->data, 0, 0,
- ta->vis_width,
- ta->vis_height);
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = 0;
+ msg.data.redraw.y0 = 0;
+ msg.data.redraw.x1 = ta->vis_width;
+ msg.data.redraw.y1 = ta->vis_height;
+
+ ta->callback(ta->data, &msg);
}
} else if (mouse & BROWSER_MOUSE_DOUBLE_CLICK) {
@@ -1488,24 +1917,18 @@ bool textarea_mouse_action(struct textarea *ta,
browser_mouse_state mouse,
textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
c_start = ta->drag_start_char;
c_end = c_off;
- return textarea_select(ta, c_start, c_end);
- }
+ ta->drag_info.type = TEXTAREA_DRAG_SELECTION;
- return true;
-}
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_DRAG_REPORT;
+ msg.data.drag = ta->drag_info.type;
+ ta->callback(ta->data, &msg);
-/* exported interface, documented in textarea.h */
-bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
- int x, int y)
-{
- int c_end;
- size_t b_off;
- unsigned int c_off;
+ return textarea_select(ta, c_start, c_end);
+ }
- textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
- c_end = c_off;
- return textarea_select(ta, ta->drag_start_char, c_end);
+ return true;
}
@@ -1522,8 +1945,18 @@ void textarea_get_dimensions(struct textarea *ta, int *width, int
*height)
/* exported interface, documented in textarea.h */
void textarea_set_dimensions(struct textarea *ta, int width, int height)
{
+ struct textarea_msg msg;
+
ta->vis_width = width;
ta->vis_height = height;
textarea_reflow(ta, 0);
- ta->redraw_request(ta->data, 0, 0, ta->vis_width, ta->vis_height);
+
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_REDRAW_REQUEST;
+ msg.data.redraw.x0 = 0;
+ msg.data.redraw.y0 = 0;
+ msg.data.redraw.x1 = ta->vis_width;
+ msg.data.redraw.y1 = ta->vis_height;
+
+ ta->callback(ta->data, &msg);
}
diff --git a/desktop/textarea.h b/desktop/textarea.h
index e4fa2c7..6a1a471 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -29,34 +29,83 @@
#include "desktop/browser.h"
#include "desktop/plot_style.h"
+
+struct textarea;
+
/* Text area flags */
-typedef enum textarea_flags {
- TEXTAREA_DEFAULT = (1 << 0),
- TEXTAREA_MULTILINE = (1 << 1),
- TEXTAREA_READONLY = (1 << 2)
+typedef enum {
+ TEXTAREA_DEFAULT = (1 << 0), /**< Standard input */
+ TEXTAREA_MULTILINE = (1 << 1), /**< Multiline area */
+ TEXTAREA_READONLY = (1 << 2), /**< Non-editable */
+ TEXTAREA_INTERNAL_CARET = (1 << 3) /**< Render own caret */
} textarea_flags;
+typedef enum {
+ TEXTAREA_DRAG_NONE,
+ TEXTAREA_DRAG_SCROLLBAR,
+ TEXTAREA_DRAG_SELECTION
+} textarea_drag_type;
+
+typedef enum {
+ TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */
+ TEXTAREA_MSG_REDRAW_REQUEST, /**< Textarea redraw request */
+ TEXTAREA_MSG_MOVED_CARET /**< Textarea caret moved */
+} textarea_msg_type;
+
+struct textarea_msg {
+ struct textarea *ta;
+
+ textarea_msg_type type;
+ union {
+ textarea_drag_type drag;
+ struct rect redraw;
+ struct {
+ bool hidden;
+ int x;
+ int y;
+ int height;
+ } caret;
+ } data;
+};
+
+typedef struct textarea_setup {
+ textarea_flags flags; /**< Setup flags */
+
+ int width; /**< Textarea width */
+ int height; /**< Textarea height */
+
+ int pad_top; /**< Textarea top padding */
+ int pad_right; /**< Textarea right padding */
+ int pad_bottom; /**< Textarea bottom padding */
+ int pad_left; /**< Textarea left padding */
+
+ int border_width; /**< Textarea border width */
+ colour border_col; /**< Textarea border colour */
+
+ colour selected_text; /**< Textarea selected text colour */
+ colour selected_bg; /**< Textarea selection background colour */
+ plot_font_style_t text; /**< Textarea background colour and font */
+
+} textarea_setup;
-struct textarea;
-
-typedef void(*textarea_redraw_request_callback)(void *data, int x, int y,
- int width, int height);
+/**
+ * Client callback for the textarea
+ *
+ * \param data user data passed at textarea creation
+ * \param textarea_msg textarea message data
+ */
+typedef void(*textarea_client_callback)(void *data, struct textarea_msg *msg);
/**
* Create a text area
*
- * \param width width of the text area
- * \param height width of the text area
- * \param flags text area flags
- * \param style font style
- * \param redraw_start_callback will be called when textarea wants to redraw
- * \param redraw_end_callback will be called when textarea finisjes redrawing
- * \param data user specified data which will be passed to redraw callbacks
+ * \param setup textarea settings and style
+ * \param redraw_callback will be called when textarea wants to redraw
+ * \param data user specified data which will be passed to callbacks
* \return Opaque handle for textarea or 0 on error
*/
-struct textarea *textarea_create(int width, int height,
- textarea_flags flags, const plot_font_style_t *style,
- textarea_redraw_request_callback redraw_request, void *data);
+struct textarea *textarea_create(const textarea_setup *setup,
+ textarea_client_callback callback, void *data);
/**
* Destroy a text area
@@ -106,14 +155,14 @@ int textarea_get_caret(struct textarea *ta);
/**
* Handle redraw requests for text areas
*
- * \param redraw Redraw request block
- * \param x0 left X coordinate of redraw area
- * \param y0 top Y coordinate of redraw area
- * \param x1 right X coordinate of redraw area
- * \param y1 bottom Y coordinate of redraw area
+ * \param ta textarea to render
+ * \param x x coordinate of textarea top
+ * \param y y coordinate of textarea left
+ * \param bg background colour under textarea
+ * \param clip clip rectangle
* \param ctx current redraw context
*/
-void textarea_redraw(struct textarea *ta, int x, int y,
+void textarea_redraw(struct textarea *ta, int x, int y, colour bg,
const struct rect *clip, const struct redraw_context *ctx);
/**
@@ -138,18 +187,6 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state
mouse,
int x, int y);
/**
- * Handles the end of a drag operation
- *
- * \param ta Text area
- * \param mouse the mouse state at drag end moment
- * \param x X coordinate
- * \param y Y coordinate
- * \return true if drag end was handled false otherwise
- */
-bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
- int x, int y);
-
-/**
* Gets the dimensions of a textarea
*
* \param width if not NULL, gets updated to the width of the textarea
diff --git a/desktop/tree.c b/desktop/tree.c
index 250bdd8..959b987 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -160,8 +160,7 @@ struct tree {
int height; /* Tree height */
unsigned int flags; /* Tree flags */
struct textarea *textarea; /* Handle for UTF-8 textarea */
- bool textarea_drag_start; /* whether the start of a mouse drag
- was in the textarea */
+ int ta_height; /* Textarea height */
struct node_element *editing; /* Node element being edited */
bool redraw; /* Flag indicating whether the tree
@@ -263,7 +262,6 @@ struct tree *tree_create(unsigned int flags,
tree->height = 0;
tree->flags = flags;
tree->textarea = NULL;
- tree->textarea_drag_start = false;
tree->editing = NULL;
tree->redraw = false;
tree->drag = TREE_NO_DRAG;
@@ -2078,7 +2076,10 @@ void tree_draw(struct tree *tree, int x, int y,
y = y + tree->editing->box.y;
if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON)
x += NODE_INSTEP;
- textarea_redraw(tree->textarea, x, y, &clip, &new_ctx);
+ textarea_redraw(tree->textarea, x, y,
+ plot_style_fill_tree_background.
+ fill_colour,
+ &clip, &new_ctx);
}
}
@@ -2427,9 +2428,9 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
int x,
x0 += NODE_INSTEP;
x1 = tree->editing->box.x + tree->editing->box.width;
y0 = tree->editing->box.y;
- y1 = tree->editing->box.y + tree->editing->box.height;
+ y1 = tree->editing->box.y + tree->ta_height;
- if (tree->textarea_drag_start &&
+ if (tree->drag == TREE_TEXTAREA_DRAG &&
(mouse & (BROWSER_MOUSE_HOLDING_1 |
BROWSER_MOUSE_HOLDING_2))) {
/* Track the drag path */
@@ -2438,19 +2439,7 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state
mouse, int x,
return true;
}
-
-
if ((x >= x0) && (x < x1) && (y >= y0) && (y < y1))
{
- /* Inside the textarea */
- if (mouse & (BROWSER_MOUSE_DRAG_1 |
- BROWSER_MOUSE_DRAG_2)) {
- /* Drag starting */
- tree->textarea_drag_start = true;
- tree->drag = TREE_TEXTAREA_DRAG;
- } else {
- /* Other action */
- tree->textarea_drag_start = false;
- }
textarea_mouse_action(tree->textarea, mouse,
x - x0, y - y0);
return true;
@@ -2458,8 +2447,6 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
int x,
}
}
- tree->textarea_drag_start = false;
-
/* we are not interested in the drag path, return */
if (mouse & (BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_HOLDING_2))
return true;
@@ -2832,25 +2819,25 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse,
int x0, int y0,
struct node *node;
int x, y;
- if (tree->textarea_drag_start) {
+ switch (tree->drag) {
+ case TREE_NO_DRAG:
+ case TREE_UNKNOWN_DRAG:
+ break;
+
+ case TREE_TEXTAREA_DRAG:
x = tree->editing->box.x;
y = tree->editing->box.y;
if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON)
x += NODE_INSTEP;
- textarea_drag_end(tree->textarea, mouse, x1 - x, y1 - y);
- }
-
- tree->textarea_drag_start = false;
-
- switch (tree->drag) {
- case TREE_NO_DRAG:
- case TREE_TEXTAREA_DRAG:
- case TREE_UNKNOWN_DRAG:
+ textarea_mouse_action(tree->textarea, BROWSER_MOUSE_HOVER,
+ x1 - x, y1 - y);
break;
+
case TREE_SELECT_DRAG:
tree_handle_selection_area(tree, y0, y1 - y0,
(mouse | BROWSER_MOUSE_HOLDING_2));
break;
+
case TREE_MOVE_DRAG:
if (!(tree->flags & TREE_MOVABLE))
return;
@@ -2872,7 +2859,6 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int
x0, int y0,
*/
bool tree_keypress(struct tree *tree, uint32_t key)
{
-
if (tree->editing != NULL)
switch (key) {
case KEY_ESCAPE:
@@ -2909,19 +2895,43 @@ int tree_alphabetical_sort(struct node *n1, struct node *n2)
* check the redraw flag of the tree before requesting a redraw and change the
* position to tree origin relative.
*/
-static void tree_textarea_redraw_request(void *data, int x, int y,
- int width, int height)
+
+static void tree_textarea_callback(void *data, struct textarea_msg *msg)
{
struct tree *tree = data;
- x = x + tree->editing->box.x;
- y = y + tree->editing->box.y;
- if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON)
- x += NODE_INSTEP;
+ int x, y;
- if (tree->redraw)
- tree->callbacks->redraw_request(x, y,
- width, height,
- tree->client_data);
+ switch (msg->type) {
+ case TEXTAREA_MSG_DRAG_REPORT:
+ if (msg->data.drag == TEXTAREA_DRAG_NONE) {
+ /* Textarea drag finished */
+ tree->drag = TREE_NO_DRAG;
+ } else {
+ /* Textarea drag started */
+ tree->drag = TREE_TEXTAREA_DRAG;
+ }
+ break;
+
+ case TEXTAREA_MSG_REDRAW_REQUEST:
+ x = msg->data.redraw.x0 + tree->editing->box.x;
+ y = msg->data.redraw.y0 + tree->editing->box.y;
+
+ if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON)
+ x += NODE_INSTEP;
+
+ /* Redraw the textarea */
+ if (tree->redraw)
+ tree->callbacks->redraw_request(x, y,
+ msg->data.redraw.x1 -
+ msg->data.redraw.x0,
+ msg->data.redraw.y1 -
+ msg->data.redraw.y0,
+ tree->client_data);
+ break;
+
+ default:
+ break;
+ }
}
@@ -2935,6 +2945,7 @@ void tree_start_edit(struct tree *tree, struct node_element
*element)
{
struct node *parent;
int width, height;
+ textarea_setup ta_setup;
assert(tree != NULL);
assert(element != NULL);
@@ -2959,8 +2970,25 @@ void tree_start_edit(struct tree *tree, struct node_element
*element)
if (element->type == NODE_ELEMENT_TEXT_PLUS_ICON)
width -= NODE_INSTEP;
- tree->textarea = textarea_create(width, height, TEXTAREA_DEFAULT,
- &plot_fstyle, tree_textarea_redraw_request, tree);
+ tree->ta_height = height;
+
+ ta_setup.flags = TEXTAREA_INTERNAL_CARET;
+ ta_setup.width = width;
+ ta_setup.height = tree->ta_height;
+ ta_setup.pad_top = 0;
+ ta_setup.pad_right = 4;
+ ta_setup.pad_bottom = 0;
+ ta_setup.pad_left = 4;
+ ta_setup.border_width = 1;
+ ta_setup.border_col = 0x000000;
+ ta_setup.selected_text = 0xffffff;
+ ta_setup.selected_bg = 0x000000;
+ ta_setup.text = plot_fstyle;
+ ta_setup.text.foreground = 0x000000;
+ ta_setup.text.background = 0xffffff;
+
+ tree->textarea = textarea_create(&ta_setup,
+ tree_textarea_callback, tree);
if (tree->textarea == NULL) {
tree_stop_edit(tree, false);
return;
diff --git a/gtk/treeview.c b/gtk/treeview.c
index efba9c4..1a98798 100644
--- a/gtk/treeview.c
+++ b/gtk/treeview.c
@@ -254,7 +254,7 @@ gboolean nsgtk_tree_window_button_press_event(GtkWidget *widget,
switch (event->button) {
case 1: tw->mouse_state |= BROWSER_MOUSE_PRESS_1; break;
- case 3: tw->mouse_state |= BROWSER_MOUSE_PRESS_2; break;
+ case 2: tw->mouse_state |= BROWSER_MOUSE_PRESS_2; break;
}
/* Handle the modifiers too */
if (event->state & GDK_SHIFT_MASK)
diff --git a/image/png.c b/image/png.c
index 23c7558..2a83346 100644
--- a/image/png.c
+++ b/image/png.c
@@ -502,7 +502,8 @@ png_cache_convert_error:
free((png_bytep *) row_pointers);
- bitmap_modified((struct bitmap *)bitmap);
+ if (bitmap != NULL)
+ bitmap_modified((struct bitmap *)bitmap);
return (struct bitmap *)bitmap;
}
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index e3295fe..e38188a 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -75,10 +75,9 @@
/* native proprty definition */
-#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp)
-#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp)
+#define JSAPI_PROP(name, cx, obj, vp) \
+ jsapi_property_##name(cx, obj, jsval jsapi_id, vp)
+#define JSAPI_STRICTPROP JSAPI_PROP
/* native property return value */
#define JSAPI_PROP_RVAL(cx, vp) (*(vp))
@@ -193,12 +192,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
-
/* proprty native calls */
-#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp)
-#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp)
+#define JSAPI_PROP(name, cx, obj, vp) \
+ jsapi_property_##name(cx, obj, jsval jsapi_id, vp)
+#define JSAPI_STRICTPROP JSAPI_PROP
/* native property return value */
#define JSAPI_PROP_RVAL JS_RVAL
@@ -307,10 +304,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp)
/* proprty native calls */
-#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsid jsapi_id, vp)
-#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsid jsapi_id, JSBool strict, vp)
+#define JSAPI_PROP(name, cx, obj, vp) \
+ jsapi_property_##name(cx, obj, jsid jsapi_id, vp)
+#define JSAPI_STRICTPROP(name, cx, obj, vp) \
+ jsapi_property_##name(cx, obj, jsid jsapi_id, JSBool strict, vp)
/* native property return value */
#define JSAPI_PROP_RVAL JS_RVAL
@@ -379,5 +376,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#endif
#define JSLOG(args...) LOG((args))
+#ifdef ENABLE_VERBOSE_JS_DEBUG
+#define JSDBG(args...) LOG((args))
+#else
+#define JSDBG(args...)
+#endif
#endif
diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd
index 8d5c69e..4aacccf 100644
--- a/javascript/jsapi/htmldocument.bnd
+++ b/javascript/jsapi/htmldocument.bnd
@@ -52,6 +52,9 @@ binding document {
/** location instantiated on first use */
property unshared location;
+ /* compatability mode instantiated on first use */
+ property unshared compatMode;
+
/* events through a single interface */
property unshared type EventHandler;
}
@@ -66,7 +69,7 @@ api finalise %{
getter location %{
- if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) {
+ if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) {
/* already created - return it */
return JS_TRUE;
}
@@ -95,6 +98,32 @@ getter documentURI %{
jsret = JSVAL_TO_STRING(jsstr);
%}
+
+getter compatMode %{
+ /* Returns the string "CSS1Compat" if document is in no-quirks
+ * mode or limited-quirks mode, and "BackCompat", if document
+ * is in quirks mode.
+ */
+ if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) {
+ /* already created, just use it */
+ return JS_TRUE;
+ }
+ if (private->htmlc->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL) {
+ jsret = JS_NewStringCopyN(cx, "BackCompat", SLEN("BackCompat"));
+ } else {
+ jsret = JS_NewStringCopyN(cx, "CSS1Compat", SLEN("CSS1Compat"));
+ }
+
+%}
+
+/*
+getter characterSet %{
+%}
+
+getter contentType %{
+%}
+*/
+
getter cookie %{
char *cookie_str;
cookie_str =
urldb_get_cookie(llcache_handle_get_url(private->htmlc->base.llcache), false);
@@ -144,7 +173,7 @@ getter body %{
dom_node *body;
dom_exception exc;
- JSLOG("Getting your body");
+ JSDBG("Getting your body");
/* document (html) element */
exc = dom_document_get_document_element(private->node, &element);
@@ -160,7 +189,7 @@ getter body %{
dom_node_unref(element);
}
- JSLOG("returning jsobject %p",jsret);
+ JSDBG("returning jsobject %p",jsret);
%}
@@ -190,6 +219,7 @@ operation getElementById %{
* Dom 4 says this should return a htmlcollection, libdom currently
* returns DOM 3 spec of a nodelist
*/
+/* HTMLCollection Document::getElementsByTagName(DOMString localName); */
operation getElementsByTagName %{
dom_string *localName_dom;
/* dom_html_collection *collection;*/
@@ -236,7 +266,7 @@ operation createTextNode %{
if (data != NULL) {
- JSLOG("Creating text node for string \"%s\"", data);
+ JSDBG("Creating text node for string \"%s\"", data);
exc = dom_string_create((unsigned char*)data, data_len, &data_dom);
if (exc != DOM_NO_ERR) {
return JS_FALSE;
@@ -251,7 +281,7 @@ operation createTextNode %{
jsret = jsapi_new_Text(cx, NULL, NULL, text, private->htmlc);
}
- JSLOG("returning jsobject %p",jsret);
+ JSDBG("returning jsobject %p",jsret);
%}
@@ -263,7 +293,7 @@ operation createComment %{
if (data != NULL) {
- JSLOG("Creating string \"%s\"", data);
+ JSDBG("Creating string \"%s\"", data);
exc = dom_string_create((unsigned char*)data,
data_len,
&data_dom);
@@ -271,7 +301,7 @@ operation createComment %{
return JS_FALSE;
}
- JSLOG("Creating comment object for dom string \"%s\"",
+ JSDBG("Creating comment object for dom string \"%s\"",
dom_string_data(data_dom));
exc = dom_document_create_comment(private->node,
data_dom,
@@ -284,7 +314,7 @@ operation createComment %{
jsret = jsapi_new_Comment(cx, NULL, NULL, comment, private->htmlc);
}
- JSLOG("returning jsobject %p", jsret);
+ JSDBG("returning jsobject %p", jsret);
%}
@@ -295,7 +325,7 @@ operation createElement %{
dom_element *element;
if (localName != NULL) {
- JSLOG("Creating text node for string \"%s\"", localName);
+ JSDBG("Creating text node for string \"%s\"", localName);
exc = dom_string_create((unsigned char*)localName, localName_len, &localName_dom);
if (exc != DOM_NO_ERR) {
return JS_FALSE;
@@ -310,7 +340,7 @@ operation createElement %{
jsret = jsapi_new_HTMLElement(cx, NULL, NULL, element, private->htmlc);
}
- JSLOG("returning jsobject %p",jsret);
+ JSDBG("returning jsobject %p",jsret);
%}
diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd
index 5e22f7e..33b4951 100644
--- a/javascript/jsapi/htmlelement.bnd
+++ b/javascript/jsapi/htmlelement.bnd
@@ -29,6 +29,7 @@ preamble %{
#include "htmlelement.h"
#include "text.h"
#include "location.h"
+#include "nodelist.h"
%}
@@ -114,6 +115,9 @@ binding htmlelement {
private "dom_element *" node;
private "struct html_content *" htmlc;
+ /* tag name retrieved first time its fetched and doesnt change */
+ property unshared tagName;
+
/* events through a single interface */
property unshared type EventHandler;
}
@@ -126,6 +130,180 @@ api finalise %{
/* interface Element in dom idl */
+/* readonly attribute DOMString Element::tagName; */
+getter tagName %{
+ if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) {
+ /* already created - return it */
+ return JS_TRUE;
+ }
+
+ dom_exception exc;
+ dom_string *name;
+
+ exc = dom_element_get_tag_name(private->node, &name);
+ if (name != NULL) {
+ jsret = JS_NewStringCopyN(cx, dom_string_data(name), dom_string_length(name));
+ dom_string_unref(name);
+ }
+%}
+
+/* attribute DOMString Element::id; */
+getter id %{
+ dom_string *value;
+ dom_exception exc;
+
+ exc = dom_element_get_attribute(private->node, corestring_dom_id, &value);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (value != NULL) {
+ jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
+ dom_string_unref(value);
+ }
+%}
+
+/* attribute DOMString Element::className; */
+getter className %{
+ dom_string *value;
+ dom_exception exc;
+
+ exc = dom_element_get_attribute(private->node, corestring_dom_class, &value);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (value != NULL) {
+ jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
+ dom_string_unref(value);
+ }
+%}
+
+/* DOMString? Element::getAttribute(DOMString name); */
+operation getAttribute %{
+ dom_string *value;
+ dom_string *name_dom;
+ dom_exception exc;
+
+ exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_element_get_attribute(private->node, name_dom, &value);
+ dom_string_unref(name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (value != NULL) {
+ jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
+ dom_string_unref(value);
+ }
+%}
+
+/* void Element::setAttribute(DOMString name, DOMString value); */
+operation setAttribute %{
+ dom_string *value_dom;
+ dom_string *name_dom;
+ dom_exception exc;
+
+ exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_string_create((unsigned char*)name, name_len, &value_dom);
+ if (exc != DOM_NO_ERR) {
+ dom_string_unref(name_dom);
+ return JS_FALSE;
+ }
+
+ exc = dom_element_set_attribute(private->node, name_dom, value_dom);
+ dom_string_unref(name_dom);
+ dom_string_unref(value_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+%}
+
+/* void Element::removeAttribute(DOMString name); */
+operation removeAttribute %{
+ dom_string *name_dom;
+ dom_exception exc;
+
+ exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_element_remove_attribute(private->node, name_dom);
+ dom_string_unref(name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+%}
+
+/* boolean Element::hasAttribute(DOMString name); */
+operation hasAttribute %{
+ bool result;
+ dom_string *name_dom;
+ dom_exception exc;
+
+ exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_element_has_attribute(private->node, name_dom, &result);
+ dom_string_unref(name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (result) {
+ jsret = JS_TRUE;
+ }
+%}
+
+/*
+ *
+ * Dom 4 says this should return a htmlcollection, libdom currently
+ * returns DOM 3 spec of a nodelist
+ */
+/* HTMLCollection Element::getElementsByTagName(DOMString localName); */
+operation getElementsByTagName %{
+ dom_string *localName_dom;
+ /* dom_html_collection *collection;*/
+ dom_nodelist *nodelist;
+ dom_exception exc;
+
+ exc = dom_string_create((uint8_t *)localName, localName_len, &localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_element_get_elements_by_tag_name(private->node, localName_dom,
/*&collection*/&nodelist);
+ dom_string_unref(localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (/*collection*/nodelist != NULL) {
+ /*jsret = jsapi_new_HTMLCollection(cx,
+ NULL,
+ NULL,
+ collection,
+ private->htmlc);*/
+ jsret = jsapi_new_NodeList(cx,
+ NULL,
+ NULL,
+ nodelist,
+ private->htmlc);
+ }
+
+%}
+
/*
* DOM 3 has these as the element traversal extension
*
diff --git a/javascript/jsapi/nodelist.bnd b/javascript/jsapi/nodelist.bnd
index 4aa8c47..3798096 100644
--- a/javascript/jsapi/nodelist.bnd
+++ b/javascript/jsapi/nodelist.bnd
@@ -39,6 +39,41 @@ binding nodelist {
private "struct html_content *" htmlc;
}
+api finalise %{
+ if (private != NULL) {
+ dom_nodelist_unref(private->nodelist);
+ }
+%}
+
+/* default handler for numericaly indexed property values */
+api getproperty %{
+ jsval queryprop;
+ int idx;
+ JSObject *jsret = NULL; /* Node */
+ dom_exception err;
+ dom_node *domnode;
+
+ JSAPI_PROP_IDVAL(cx, &queryprop);
+ if (JSVAL_IS_INT(queryprop)) {
+ idx = JSVAL_TO_INT(queryprop);
+ JSDBG("Index was %d", idx);
+
+
+ err = dom_nodelist_item(private->nodelist, idx, &domnode);
+ if (err != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (domnode != NULL) {
+ jsret = jsapi_new_HTMLElement(cx, NULL, NULL, (dom_element *)domnode,
private->htmlc);
+
+ JSDBG("return object:%p", jsret);
+
+ JSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsret));
+ }
+ }
+%}
+
getter length %{
dom_exception err;
@@ -62,9 +97,3 @@ operation item %{
}
%}
-api finalise %{
- if (private != NULL) {
- dom_nodelist_unref(private->nodelist);
- }
-%}
-
diff --git a/render/textinput.c b/render/textinput.c
index 71b4e53..e9c6df7 100644
--- a/render/textinput.c
+++ b/render/textinput.c
@@ -1380,12 +1380,12 @@ bool textinput_textarea_callback(struct browser_window *bw,
uint32_t key,
case KEY_PASTE:
{
- char *buff;
+ char *buff = NULL;
size_t buff_len;
bool success;
gui_get_clipboard(&buff, &buff_len);
- if (utf8 == NULL)
+ if (buff == NULL)
return false;
success = browser_window_paste_text(bw, buff, buff_len, true);
@@ -2027,12 +2027,12 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t
key,
case KEY_PASTE:
{
- char *buff;
+ char *buff = NULL;
size_t buff_len;
bool success;
gui_get_clipboard(&buff, &buff_len);
- if (utf8 == NULL)
+ if (buff == NULL)
return false;
success = browser_window_paste_text(bw, buff, buff_len, true);
diff --git a/riscos/distribution/!System/310/Modules/Iconv,ffa
b/riscos/distribution/!System/310/Modules/Iconv,ffa
index b3eb47e..8a9cc3a 100644
Binary files a/riscos/distribution/!System/310/Modules/Iconv,ffa and
b/riscos/distribution/!System/310/Modules/Iconv,ffa differ
diff --git a/riscos/distribution/3rdParty/Iconv/ReadMe
b/riscos/distribution/3rdParty/Iconv/ReadMe
index fda952a..907c2c7 100644
--- a/riscos/distribution/3rdParty/Iconv/ReadMe
+++ b/riscos/distribution/3rdParty/Iconv/ReadMe
@@ -24,7 +24,7 @@ See the ReadMe file in that directory for further information.
Licence
=======
-Iconv is Copyright � 2004-11 J-M Bell
+Iconv is Copyright � 2004-13 J-M Bell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/riscos/distribution/3rdParty/Iconv/doc/ChangeLog
b/riscos/distribution/3rdParty/Iconv/doc/ChangeLog
index 4c17511..3a22a45 100644
--- a/riscos/distribution/3rdParty/Iconv/doc/ChangeLog
+++ b/riscos/distribution/3rdParty/Iconv/doc/ChangeLog
@@ -105,3 +105,10 @@ Iconv Changelog
- Toolchain used to build 0.10 turns out to have produced broken code.
- Minor additions to the charset alias mapping file.
+0.12 20-Jan-2013
+---------------
+
+ - Master alias mapping file now lives in ROOL repository.
+ - Correct handling of trailing valid shift sequences. Previously would
+ erroneously report EINVAL, instead of silently accepting them.
+ - Add proper transliteration behaviour when requested using //TRANSLIT.
diff --git a/riscos/filetype.c b/riscos/filetype.c
index ec15b36..529f867 100644
--- a/riscos/filetype.c
+++ b/riscos/filetype.c
@@ -305,9 +305,21 @@ int ro_content_native_type(hlcache_handle *c)
*/
int ro_content_filetype_from_mime_type(lwc_string *mime_type)
{
- int file_type;
+ int file_type, index;
os_error *error;
+ /* Search internal type map */
+ for (index = TYPE_MAP_COUNT; index > 0; index--) {
+ const struct type_entry *e = &type_map[index - 1];
+
+ if (strlen(e->mime_type) == lwc_string_length(mime_type) &&
+ strncasecmp(e->mime_type,
+ lwc_string_data(mime_type),
+ lwc_string_length(mime_type)) == 0)
+ return e->file_type;
+ }
+
+ /* Ask MimeMap module */
error = xmimemaptranslate_mime_type_to_filetype(
lwc_string_data(mime_type), (bits *) &file_type);
if (error)
diff --git a/riscos/font.c b/riscos/font.c
index 717b960..8d4c6d3 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -255,6 +255,7 @@ bool nsfont_width(const plot_font_style_t *fstyle,
else
LOG(("rufl_width: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *width = 0;
return false;
}
@@ -303,6 +304,8 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle,
else
LOG(("rufl_x_to_offset: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}
@@ -355,11 +358,27 @@ bool nsfont_split(const plot_font_style_t *fstyle,
else
LOG(("rufl_split: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}
- while (*char_offset && string[*char_offset] != ' ')
- (*char_offset)--;
+ if (*char_offset != length) {
+ /* we found something to split at */
+ size_t orig = *char_offset;
+
+ /* ensure a space at <= the split point we found */
+ while (*char_offset && string[*char_offset] != ' ')
+ (*char_offset)--;
+
+ /* nothing valid found <= split point, advance to next space */
+ if (*char_offset == 0) {
+ *char_offset = orig;
+ while (*char_offset != length &&
+ string[*char_offset] != ' ')
+ (*char_offset)++;
+ }
+ }
code = rufl_width(font_family, font_style, font_size,
string, *char_offset,
@@ -372,6 +391,8 @@ bool nsfont_split(const plot_font_style_t *fstyle,
else
LOG(("rufl_width: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}
diff --git a/riscos/gui.c b/riscos/gui.c
index 8eac42d..e786f67 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -944,6 +944,8 @@ void ro_gui_cleanup(void)
{
ro_gui_buffer_close();
xhourglass_off();
+ /* Uninstall NetSurf-specific fonts */
+ xos_cli("FontRemove NetSurf:Resources.Fonts.");
}
@@ -1280,6 +1282,22 @@ void ro_gui_drag_end(wimp_dragged *drag)
* Handle Key_Pressed events.
*/
+static void ro_gui_keypress_cb(void *pw)
+{
+ wimp_key *key = (wimp_key *) pw;
+
+ if (ro_gui_wimp_event_keypress(key) == false) {
+ os_error *error = xwimp_process_key(key->c);
+ if (error) {
+ LOG(("xwimp_process_key: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ }
+ }
+
+ free(key);
+}
+
void ro_gui_keypress(wimp_key *key)
{
if (key->c == wimp_KEY_ESCAPE &&
@@ -1290,8 +1308,17 @@ void ro_gui_keypress(wimp_key *key)
(easier than finding somewhere safe to abort the drag) */
ro_gui_drag_box_cancel();
gui_current_drag_type = GUI_DRAG_NONE;
- }
- else if (!ro_gui_wimp_event_keypress(key)) {
+ } else if (key->c == 22 /* Ctrl-V */) {
+ wimp_key *copy;
+
+ /* Must copy the keypress as it's on the stack */
+ copy = malloc(sizeof(wimp_key));
+ if (copy == NULL)
+ return;
+ memcpy(copy, key, sizeof(wimp_key));
+
+ ro_gui_selection_prepare_paste(key->w, ro_gui_keypress_cb, copy);
+ } else if (ro_gui_wimp_event_keypress(key) == false) {
os_error *error = xwimp_process_key(key->c);
if (error) {
LOG(("xwimp_process_key: 0x%x: %s",
@@ -1318,9 +1345,10 @@ void ro_gui_user_message(wimp_event_no event, wimp_message
*message)
if (event == wimp_USER_MESSAGE_ACKNOWLEDGE) {
if (ro_print_current_window)
ro_print_dataload_bounce(message);
- }
- else
+ } else if (ro_gui_selection_prepare_paste_dataload(
+ (wimp_full_message_data_xfer *) message) == false) {
ro_msg_dataload(message);
+ }
break;
case message_DATA_LOAD_ACK:
@@ -1770,6 +1798,9 @@ void ro_msg_datasave(wimp_message *message)
ro_msg_terminate_filename(dataxfer);
+ if (ro_gui_selection_prepare_paste_datasave(dataxfer))
+ return;
+
switch (dataxfer->file_type) {
case FILETYPE_ACORN_URI:
case FILETYPE_ANT_URL:
diff --git a/riscos/save.c b/riscos/save.c
index f61fd01..12af6ab 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -1239,6 +1239,11 @@ void ro_gui_save_set_state(hlcache_handle *h, gui_save_type
save_type,
}
/* filename is utf8 */
+ if (save_type == GUI_SAVE_COMPLETE && leaf_len > 0) {
+ leaf_buf[0] = '!';
+ leaf_buf++;
+ leaf_len--;
+ }
strncpy(leaf_buf, name, leaf_len);
leaf_buf[leaf_len - 1] = 0;
diff --git a/riscos/scripts/Run b/riscos/scripts/Run
index d3b9988..8f3b873 100644
--- a/riscos/scripts/Run
+++ b/riscos/scripts/Run
@@ -88,12 +88,12 @@ RMEnsure Tinct 0.13 Error NetSurf requires Tinct 0.13 or later. This
can be down
| Ensure Iconv
|
http://www.netsurf-browser.org/iconv/
-RMEnsure Iconv 0.11 NetSurfRMLoad System:Modules.Iconv
-RMEnsure Iconv 0.11 Error NetSurf requires Iconv 0.11 or later. This can be downloaded
from
http://www.netsurf-browser.org/iconv/
+RMEnsure Iconv 0.12 NetSurfRMLoad System:Modules.Iconv
+RMEnsure Iconv 0.12 Error NetSurf requires Iconv 0.12 or later. This can be downloaded
from
http://www.netsurf-browser.org/iconv/
| Ensure CryptRandom
-RMEnsure CryptRandom 0.12 NetSurfRMLoad System:Modules.CryptRand
-RMEnsure CryptRandom 0.12 Error NetSurf requires CryptRandom 0.12 or later. This can be
downloaded from
http://www.riscos.info/index.php/CryptRandom
+RMEnsure CryptRandom 0.13 NetSurfRMLoad System:Modules.CryptRand
+RMEnsure CryptRandom 0.13 Error NetSurf requires CryptRandom 0.13 or later. This can be
downloaded from
http://www.markettos.org.uk/riscos/crypto/
| Disable SpecialFX, if present
Set NetSurf$SpecialFX 1
@@ -114,6 +114,3 @@ FontInstall NetSurf:Resources.Fonts.
WIMPSLOT
Run <NetSurf$Dir>.!RunImage %*0 2><Wimp$ScrapDir>.WWW.NetSurf.Log
-
-| Uninstall NetSurf-specific fonts
-FontRemove NetSurf:Resources.Fonts.
diff --git a/riscos/textselection.c b/riscos/textselection.c
index d1d4340..0cb8eb2 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -56,11 +56,17 @@ static bool drag_claimed = false;
static bool owns_clipboard = false;
static bool owns_caret_and_selection = false;
-/* current clipboard contents if we own the clipboard */
+/* Current clipboard contents if we own the clipboard
+ * Current paste buffer if we don't
+ */
static char *clipboard = NULL;
-static size_t clip_alloc = 0;
static size_t clip_length = 0;
+/* Paste context */
+static ro_gui_selection_prepare_paste_cb paste_cb = NULL;
+static void *paste_cb_pw = NULL;
+static int paste_prev_message = 0;
+
static void ro_gui_discard_clipboard_contents(void);
static void ro_gui_dragging_bounced(wimp_message *message);
@@ -207,22 +213,21 @@ void gui_clear_selection(struct gui_window *g)
void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
- utf8_convert_ret res;
char *new_cb;
if (length == 0)
return;
- /* Convert to local encoding */
- res = utf8_to_local_encoding(buffer, length, &new_cb);
-
- if (res != UTF8_CONVERT_OK || new_cb == NULL)
+ new_cb = malloc(length);
+ if (new_cb == NULL)
return;
- /* Replace existing clipboard contents with converted text */
+ memcpy(new_cb, buffer, length);
+
+ /* Replace existing clipboard contents */
free(clipboard);
clipboard = new_cb;
- clip_alloc = clip_length = strlen(new_cb);
+ clip_length = length;
if (!owns_clipboard) {
/* Tell RO we now own clipboard */
@@ -253,7 +258,7 @@ void gui_set_clipboard(const char *buffer, size_t length,
/**
* Core asks front end for clipboard contents.
*
- * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
+ * \param buffer UTF-8 text, allocated by front end, ownership yielded to core
* \param length Byte length of UTF-8 text in buffer
*/
void gui_get_clipboard(char **buffer, size_t *length)
@@ -261,64 +266,180 @@ void gui_get_clipboard(char **buffer, size_t *length)
*buffer = NULL;
*length = 0;
- if (owns_clipboard) {
- if (clip_length > 0) {
- char *utf8;
- utf8_convert_ret ret;
- /* Clipboard is in local encoding so
- * convert to UTF8 */
- ret = utf8_from_local_encoding(clipboard,
- clip_length, &utf8);
- if (ret == UTF8_CONVERT_OK) {
- *buffer = utf8;
- *length = strlen(utf8);
- }
+ if (clip_length > 0) {
+ char *cb = malloc(clip_length);
+ if (cb != NULL) {
+ memcpy(cb, clipboard, clip_length);
+ *buffer = cb;
+ *length = clip_length;
}
- } else {
- /** TODO: Handle case when we don't own the clipboard */
+ }
+}
+
-/*
http://www.starfighter.acornarcade.com/mysite/articles/SelectionModel.html
+/**
+ * Discard the current contents of the clipboard, if any, releasing the
+ * memory it uses.
*/
-/* wimp_full_message_data_request msg;
- os_error *error;
- os_coord pos;
+void ro_gui_discard_clipboard_contents(void)
+{
+ free(clipboard);
+ clip_length = 0;
+}
+
- if (!ro_gui_window_to_screen_pos(g, x, y, &pos))
- return;
+static void ro_gui_selection_prepare_paste_complete(void)
+{
+ ro_gui_selection_prepare_paste_cb cb = paste_cb;
+ void *pw = paste_cb_pw;
+
+ paste_cb = NULL;
+ paste_cb_pw = NULL;
+ paste_prev_message = 0;
+
+ cb(pw);
+}
+
+static void ro_gui_selection_prepare_paste_bounced(wimp_message *message)
+{
+ ro_gui_selection_prepare_paste_complete();
+}
+
+/**
+ * Prepare to paste data from another application
+ *
+ * \param w Window being pasted into
+ * \param cb Callback to call once preparation is complete
+ * \param pw Private data for callback
+ */
+
+void ro_gui_selection_prepare_paste(wimp_w w,
+ ro_gui_selection_prepare_paste_cb cb, void *pw)
+{
+ if (owns_clipboard) {
+ /* We own the clipboard: we're already prepared */
+ cb(pw);
+ } else {
+ /* Someone else owns the clipboard: request its contents */
+ wimp_full_message_data_request msg;
+ bool success;
+
+ ro_gui_discard_clipboard_contents();
msg.size = sizeof(msg);
msg.your_ref = 0;
msg.action = message_DATA_REQUEST;
- msg.w = g->window;
+ msg.w = w;
msg.i = -1;
- msg.pos.x = pos.x;
- msg.pos.y = pos.y;
+ msg.pos.x = 0;
+ msg.pos.y = 0;
msg.flags = wimp_DATA_REQUEST_CLIPBOARD;
msg.file_types[0] = osfile_TYPE_TEXT;
msg.file_types[1] = ~0;
- error = xwimp_send_message(wimp_USER_MESSAGE,
- (wimp_message*)&msg, wimp_BROADCAST);
- if (error) {
- LOG(("xwimp_send_message: 0x%x : %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
+ success = ro_message_send_message(wimp_USER_MESSAGE_RECORDED,
+ (wimp_message *) &msg, wimp_BROADCAST,
+ ro_gui_selection_prepare_paste_bounced);
+ if (success == false) {
+ /* Ensure key is handled, anyway */
+ cb(pw);
+ } else {
+ /* Set up paste context */
+ paste_cb = cb;
+ paste_cb_pw = pw;
+ paste_prev_message = msg.my_ref;
}
-*/ }
+ }
}
-
/**
- * Discard the current contents of the clipboard, if any, releasing the
- * memory it uses.
+ * Prepare to paste data from another application (step 2)
+ *
+ * \param dataxfer DataSave message
+ * \return True if message was handled, false otherwise
*/
+bool ro_gui_selection_prepare_paste_datasave(
+ wimp_full_message_data_xfer *dataxfer)
+{
+ bool success;
-void ro_gui_discard_clipboard_contents(void)
+ /* Ignore messages that aren't for us */
+ if (dataxfer->your_ref == 0 || dataxfer->your_ref != paste_prev_message)
+ return false;
+
+ /* We're done if the paste data isn't text */
+ if (dataxfer->file_type != osfile_TYPE_TEXT) {
+ ro_gui_selection_prepare_paste_complete();
+ return true;
+ }
+
+ /* Generate and send DataSaveAck */
+ dataxfer->your_ref = dataxfer->my_ref;
+ dataxfer->size = offsetof(wimp_full_message_data_xfer, file_name) + 16;
+ dataxfer->action = message_DATA_SAVE_ACK;
+ dataxfer->est_size = -1;
+ memcpy(dataxfer->file_name, "<Wimp$Scrap>",
SLEN("<Wimp$Scrap>") + 1);
+
+ success = ro_message_send_message(wimp_USER_MESSAGE_RECORDED,
+ (wimp_message *) dataxfer, dataxfer->sender,
+ ro_gui_selection_prepare_paste_bounced);
+ if (success == false) {
+ ro_gui_selection_prepare_paste_complete();
+ } else {
+ paste_prev_message = dataxfer->my_ref;
+ }
+
+ return true;
+}
+
+
+/**
+ * Prepare to paste data from another application (step 3)
+ *
+ * \param dataxfer DataLoad message
+ * \return True if message was handled, false otherwise
+ */
+bool ro_gui_selection_prepare_paste_dataload(
+ wimp_full_message_data_xfer *dataxfer)
{
- if (clip_alloc) free(clipboard);
- clip_alloc = 0;
- clip_length = 0;
+ FILE *fp;
+ long size;
+ char *local_cb;
+ utf8_convert_ret ret;
+
+ /* Ignore messages that aren't for us */
+ if (dataxfer->your_ref == 0 || dataxfer->your_ref != paste_prev_message)
+ return false;
+
+ fp = fopen(dataxfer->file_name, "r");
+ if (fp != NULL) {
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+
+ local_cb = malloc(size);
+ if (local_cb != NULL) {
+ fread(local_cb, 1, size, fp);
+
+ fclose(fp);
+
+ ret = utf8_from_local_encoding(local_cb, size,
+ &clipboard);
+ if (ret == UTF8_CONVERT_OK) {
+ clip_length = strlen(clipboard);
+ }
+ }
+ }
+
+ /* Send DataLoadAck */
+ dataxfer->action = message_DATA_LOAD_ACK;
+ dataxfer->your_ref = dataxfer->my_ref;
+ ro_message_send_message(wimp_USER_MESSAGE,
+ (wimp_message *) dataxfer, dataxfer->sender, NULL);
+
+ ro_gui_selection_prepare_paste_complete();
+ return true;
}
@@ -398,18 +519,31 @@ void ro_gui_selection_data_request(wimp_full_message_data_request
*req)
bool ro_gui_save_clipboard(const char *path)
{
+ char *local_cb;
+ utf8_convert_ret ret;
os_error *error;
assert(clip_length > 0 && clipboard);
+
+ ret = utf8_to_local_encoding(clipboard, clip_length, &local_cb);
+ if (ret != UTF8_CONVERT_OK) {
+ warn_user("SaveError", "Could not convert");
+ return false;
+ }
+
error = xosfile_save_stamped(path, osfile_TYPE_TEXT,
- (byte*)clipboard,
- (byte*)clipboard + clip_length);
+ (byte*) local_cb,
+ (byte*) local_cb + strlen(local_cb));
+
+ free(local_cb);
+
if (error) {
LOG(("xosfile_save_stamped: 0x%x: %s",
error->errnum, error->errmess));
warn_user("SaveError", error->errmess);
return false;
}
+
return true;
}
diff --git a/riscos/textselection.h b/riscos/textselection.h
index 544636e..a3763b4 100644
--- a/riscos/textselection.h
+++ b/riscos/textselection.h
@@ -26,6 +26,14 @@
#include "oslib/wimp.h"
#include "desktop/gui.h"
+typedef void (*ro_gui_selection_prepare_paste_cb)(void *pw);
+
+void ro_gui_selection_prepare_paste(wimp_w w,
+ ro_gui_selection_prepare_paste_cb cb, void *pw);
+bool ro_gui_selection_prepare_paste_datasave(
+ wimp_full_message_data_xfer *dataxfer);
+bool ro_gui_selection_prepare_paste_dataload(
+ wimp_full_message_data_xfer *dataxfer);
void ro_gui_selection_drag_end(struct gui_window *g, wimp_dragged *drag);
void ro_gui_selection_claim_entity(wimp_full_message_claim_entity *claim);
diff --git a/riscos/window.c b/riscos/window.c
index 5351054..2f8bec6 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -74,6 +74,7 @@
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/content-handlers/sprite.h"
+#include "riscos/textselection.h"
#include "riscos/toolbar.h"
#include "riscos/thumbnail.h"
#include "riscos/url_complete.h"
@@ -2600,6 +2601,14 @@ void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu
*menu,
}
+static void ro_gui_window_paste_cb(void *pw)
+{
+ struct browser_window *bw = pw;
+
+ browser_window_key_press(bw, KEY_PASTE);
+}
+
+
/**
* Handle selections from a browser window menu
*
@@ -2833,7 +2842,7 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
browser_window_key_press(bw, KEY_CUT_SELECTION);
break;
case BROWSER_SELECTION_PASTE:
- browser_window_key_press(bw, KEY_PASTE);
+ ro_gui_selection_prepare_paste(w, ro_gui_window_paste_cb, bw);
break;
case BROWSER_SELECTION_ALL:
browser_window_key_press(bw, KEY_SELECT_ALL);
diff --git a/test/js/dom-getElementsByTagName.html
b/test/js/dom-getElementsByTagName.html
index 02cdffc..2f03e7b 100644
--- a/test/js/dom-getElementsByTagName.html
+++ b/test/js/dom-getElementsByTagName.html
@@ -15,6 +15,16 @@
for (var i=0;i<pcol.length;i++)
{
document.write(pcol.item(i).textContent);
+document.write("|");
+}
+</script>
+<br>
+<p>
+<script>
+for (var i=0;i<pcol.length;i++)
+{
+document.write(pcol[i].textContent);
+document.write("|");
}
</script>
</body>
diff --git a/utils/corestrings.c b/utils/corestrings.c
index 65666df..f39a59c 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -134,6 +134,7 @@ dom_string *corestring_dom_cellpadding;
dom_string *corestring_dom_cellspacing;
dom_string *corestring_dom_change;
dom_string *corestring_dom_charset;
+dom_string *corestring_dom_class;
dom_string *corestring_dom_click;
dom_string *corestring_dom_close;
dom_string *corestring_dom_color;
@@ -357,6 +358,7 @@ void corestrings_fini(void)
CSS_DOM_STRING_UNREF(cellspacing);
CSS_DOM_STRING_UNREF(change);
CSS_DOM_STRING_UNREF(charset);
+ CSS_DOM_STRING_UNREF(class);
CSS_DOM_STRING_UNREF(click);
CSS_DOM_STRING_UNREF(close);
CSS_DOM_STRING_UNREF(color);
@@ -611,6 +613,7 @@ nserror corestrings_init(void)
CSS_DOM_STRING_INTERN(cellspacing);
CSS_DOM_STRING_INTERN(change);
CSS_DOM_STRING_INTERN(charset);
+ CSS_DOM_STRING_INTERN(class);
CSS_DOM_STRING_INTERN(click);
CSS_DOM_STRING_INTERN(close);
CSS_DOM_STRING_INTERN(color);
diff --git a/utils/corestrings.h b/utils/corestrings.h
index 08d2545..e28b713 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -140,6 +140,7 @@ extern struct dom_string *corestring_dom_cellpadding;
extern struct dom_string *corestring_dom_cellspacing;
extern struct dom_string *corestring_dom_change;
extern struct dom_string *corestring_dom_charset;
+extern struct dom_string *corestring_dom_class;
extern struct dom_string *corestring_dom_click;
extern struct dom_string *corestring_dom_close;
extern struct dom_string *corestring_dom_color;
diff --git a/utils/nsurl.c b/utils/nsurl.c
index 18577b6..23e177e 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -720,6 +720,9 @@ static nserror nsurl__create_from_section(const char * const url_s,
break;
}
+ if (end < start)
+ end = start;
+
length = end - start;
/* Stage 1: Normalise the required section */
diff --git a/utils/transtab b/utils/transtab
deleted file mode 100644
index ccb0017..0000000
--- a/utils/transtab
+++ /dev/null
@@ -1,1688 +0,0 @@
-% Source:
http://www.cl.cam.ac.uk/~mgk25/unicode.html#libs
-%
-% "This package contains a table for transliterating ISO 10646 texts into
-% best-effort representations using smaller coded character sets (ASCII,
-% ISO 8859, etc.). It is primarily intended for inclusion into the GNU C
-% library, but might be of use for other applications as well. The table
-% is freely available to anyone."
-
-% APOSTROPHE
-<U0027> <U2019>
-% GRAVE ACCENT
-<U0060> <U201B>;<U2018>
-% NO-BREAK SPACE
-<U00A0> <U0020>
-% INVERTED EXCLAMATION MARK
-<U00A1> <U0021>
-% CENT SIGN
-<U00A2> <U0063>
-% POUND SIGN
-<U00A3> "<U0047><U0042><U0050>"
-% YEN SIGN
-<U00A5> <U0059>
-% BROKEN BAR
-<U00A6> <U007C>
-% SECTION SIGN
-<U00A7> <U0053>
-% DIAERESIS
-<U00A8> <U0022>
-% COPYRIGHT SIGN
-<U00A9> "<U0028><U0063><U0029>";<U0063>
-% FEMININE ORDINAL INDICATOR
-<U00AA> <U0061>
-% LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-<U00AB> "<U003C><U003C>"
-% NOT SIGN
-<U00AC> <U002D>
-% SOFT HYPHEN
-<U00AD> <U002D>
-% REGISTERED SIGN
-<U00AE> "<U0028><U0052><U0029>"
-% MACRON
-<U00AF> <U002D>
-% DEGREE SIGN
-<U00B0> <U0020>
-% PLUS-MINUS SIGN
-<U00B1> "<U002B><U002F><U002D>"
-% SUPERSCRIPT TWO
-<U00B2> "<U005E><U0032>";<U0032>
-% SUPERSCRIPT THREE
-<U00B3> "<U005E><U0033>";<U0033>
-% ACUTE ACCENT
-<U00B4> <U0027>
-% MICRO SIGN
-<U00B5> <U03BC>;<U0075>
-% PILCROW SIGN
-<U00B6> <U0050>
-% MIDDLE DOT
-<U00B7> <U002E>
-% CEDILLA
-<U00B8> <U002C>
-% SUPERSCRIPT ONE
-<U00B9> "<U005E><U0031>";<U0031>
-% MASCULINE ORDINAL INDICATOR
-<U00BA> <U006F>
-% RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
-<U00BB> "<U003E><U003E>"
-% VULGAR FRACTION ONE QUARTER
-<U00BC> "<U0020><U0031><U002F><U0034>"
-% VULGAR FRACTION ONE HALF
-<U00BD> "<U0020><U0031><U002F><U0032>"
-% VULGAR FRACTION THREE QUARTERS
-<U00BE> "<U0020><U0033><U002F><U0034>"
-% INVERTED QUESTION MARK
-<U00BF> <U003F>
-% LATIN CAPITAL LETTER A WITH GRAVE
-<U00C0> <U0041>
-% LATIN CAPITAL LETTER A WITH ACUTE
-<U00C1> <U0041>
-% LATIN CAPITAL LETTER A WITH CIRCUMFLEX
-<U00C2> <U0041>
-% LATIN CAPITAL LETTER A WITH TILDE
-<U00C3> <U0041>
-% LATIN CAPITAL LETTER A WITH DIAERESIS
-<U00C4> "<U0041><U0065>";<U0041>
-% LATIN CAPITAL LETTER A WITH RING ABOVE
-<U00C5> "<U0041><U0061>";<U0041>
-% LATIN CAPITAL LETTER AE
-<U00C6> "<U0041><U0045>";<U0041>
-% LATIN CAPITAL LETTER C WITH CEDILLA
-<U00C7> <U0043>
-% LATIN CAPITAL LETTER E WITH GRAVE
-<U00C8> <U0045>
-% LATIN CAPITAL LETTER E WITH ACUTE
-<U00C9> <U0045>
-% LATIN CAPITAL LETTER E WITH CIRCUMFLEX
-<U00CA> <U0045>
-% LATIN CAPITAL LETTER E WITH DIAERESIS
-<U00CB> <U0045>
-% LATIN CAPITAL LETTER I WITH GRAVE
-<U00CC> <U0049>
-% LATIN CAPITAL LETTER I WITH ACUTE
-<U00CD> <U0049>
-% LATIN CAPITAL LETTER I WITH CIRCUMFLEX
-<U00CE> <U0049>
-% LATIN CAPITAL LETTER I WITH DIAERESIS
-<U00CF> <U0049>
-% LATIN CAPITAL LETTER ETH
-<U00D0> <U0044>
-% LATIN CAPITAL LETTER N WITH TILDE
-<U00D1> <U004E>
-% LATIN CAPITAL LETTER O WITH GRAVE
-<U00D2> <U004F>
-% LATIN CAPITAL LETTER O WITH ACUTE
-<U00D3> <U004F>
-% LATIN CAPITAL LETTER O WITH CIRCUMFLEX
-<U00D4> <U004F>
-% LATIN CAPITAL LETTER O WITH TILDE
-<U00D5> <U004F>
-% LATIN CAPITAL LETTER O WITH DIAERESIS
-<U00D6> "<U004F><U0065>";<U004F>
-% MULTIPLICATION SIGN
-<U00D7> <U0078>
-% LATIN CAPITAL LETTER O WITH STROKE
-<U00D8> <U004F>
-% LATIN CAPITAL LETTER U WITH GRAVE
-<U00D9> <U0055>
-% LATIN CAPITAL LETTER U WITH ACUTE
-<U00DA> <U0055>
-% LATIN CAPITAL LETTER U WITH CIRCUMFLEX
-<U00DB> <U0055>
-% LATIN CAPITAL LETTER U WITH DIAERESIS
-<U00DC> "<U0055><U0065>";<U0055>
-% LATIN CAPITAL LETTER Y WITH ACUTE
-<U00DD> <U0059>
-% LATIN CAPITAL LETTER THORN
-<U00DE> "<U0054><U0068>"
-% LATIN SMALL LETTER SHARP S
-<U00DF> "<U0073><U0073>";<U03B2>
-% LATIN SMALL LETTER A WITH GRAVE
-<U00E0> <U0061>
-% LATIN SMALL LETTER A WITH ACUTE
-<U00E1> <U0061>
-% LATIN SMALL LETTER A WITH CIRCUMFLEX
-<U00E2> <U0061>
-% LATIN SMALL LETTER A WITH TILDE
-<U00E3> <U0061>
-% LATIN SMALL LETTER A WITH DIAERESIS
-<U00E4> "<U0061><U0065>";<U0061>
-% LATIN SMALL LETTER A WITH RING ABOVE
-<U00E5> "<U0061><U0061>";<U0061>
-% LATIN SMALL LETTER AE
-<U00E6> "<U0061><U0065>";<U0061>
-% LATIN SMALL LETTER C WITH CEDILLA
-<U00E7> <U0063>
-% LATIN SMALL LETTER E WITH GRAVE
-<U00E8> <U0065>
-% LATIN SMALL LETTER E WITH ACUTE
-<U00E9> <U0065>
-% LATIN SMALL LETTER E WITH CIRCUMFLEX
-<U00EA> <U0065>
-% LATIN SMALL LETTER E WITH DIAERESIS
-<U00EB> <U0065>
-% LATIN SMALL LETTER I WITH GRAVE
-<U00EC> <U0069>
-% LATIN SMALL LETTER I WITH ACUTE
-<U00ED> <U0069>
-% LATIN SMALL LETTER I WITH CIRCUMFLEX
-<U00EE> <U0069>
-% LATIN SMALL LETTER I WITH DIAERESIS
-<U00EF> <U0069>
-% LATIN SMALL LETTER ETH
-<U00F0> <U0064>
-% LATIN SMALL LETTER N WITH TILDE
-<U00F1> <U006E>
-% LATIN SMALL LETTER O WITH GRAVE
-<U00F2> <U006F>
-% LATIN SMALL LETTER O WITH ACUTE
-<U00F3> <U006F>
-% LATIN SMALL LETTER O WITH CIRCUMFLEX
-<U00F4> <U006F>
-% LATIN SMALL LETTER O WITH TILDE
-<U00F5> <U006F>
-% LATIN SMALL LETTER O WITH DIAERESIS
-<U00F6> "<U006F><U0065>";<U006F>
-% DIVISION SIGN
-<U00F7> <U003A>
-% LATIN SMALL LETTER O WITH STROKE
-<U00F8> <U006F>
-% LATIN SMALL LETTER U WITH GRAVE
-<U00F9> <U0075>
-% LATIN SMALL LETTER U WITH ACUTE
-<U00FA> <U0075>
-% LATIN SMALL LETTER U WITH CIRCUMFLEX
-<U00FB> <U0075>
-% LATIN SMALL LETTER U WITH DIAERESIS
-<U00FC> "<U0075><U0065>";<U0075>
-% LATIN SMALL LETTER Y WITH ACUTE
-<U00FD> <U0079>
-% LATIN SMALL LETTER THORN
-<U00FE> "<U0074><U0068>"
-% LATIN SMALL LETTER Y WITH DIAERESIS
-<U00FF> <U0079>
-% LATIN CAPITAL LETTER A WITH MACRON
-<U0100> <U0041>
-% LATIN SMALL LETTER A WITH MACRON
-<U0101> <U0061>
-% LATIN CAPITAL LETTER A WITH BREVE
-<U0102> <U0041>
-% LATIN SMALL LETTER A WITH BREVE
-<U0103> <U0061>
-% LATIN CAPITAL LETTER A WITH OGONEK
-<U0104> <U0041>
-% LATIN SMALL LETTER A WITH OGONEK
-<U0105> <U0061>
-% LATIN CAPITAL LETTER C WITH ACUTE
-<U0106> <U0043>
-% LATIN SMALL LETTER C WITH ACUTE
-<U0107> <U0063>
-% LATIN CAPITAL LETTER C WITH CIRCUMFLEX
-<U0108> "<U0043><U0068>";<U0043>
-% LATIN SMALL LETTER C WITH CIRCUMFLEX
-<U0109> "<U0063><U0068>";<U0063>
-% LATIN CAPITAL LETTER C WITH DOT ABOVE
-<U010A> <U0043>
-% LATIN SMALL LETTER C WITH DOT ABOVE
-<U010B> <U0063>
-% LATIN CAPITAL LETTER C WITH CARON
-<U010C> <U0043>
-% LATIN SMALL LETTER C WITH CARON
-<U010D> <U0063>
-% LATIN CAPITAL LETTER D WITH CARON
-<U010E> <U0044>
-% LATIN SMALL LETTER D WITH CARON
-<U010F> <U0064>
-% LATIN CAPITAL LETTER D WITH STROKE
-<U0110> <U0044>
-% LATIN SMALL LETTER D WITH STROKE
-<U0111> <U0064>
-% LATIN CAPITAL LETTER E WITH MACRON
-<U0112> <U0045>
-% LATIN SMALL LETTER E WITH MACRON
-<U0113> <U0065>
-% LATIN CAPITAL LETTER E WITH BREVE
-<U0114> <U0045>
-% LATIN SMALL LETTER E WITH BREVE
-<U0115> <U0065>
-% LATIN CAPITAL LETTER E WITH DOT ABOVE
-<U0116> <U0045>
-% LATIN SMALL LETTER E WITH DOT ABOVE
-<U0117> <U0065>
-% LATIN CAPITAL LETTER E WITH OGONEK
-<U0118> <U0045>
-% LATIN SMALL LETTER E WITH OGONEK
-<U0119> <U0065>
-% LATIN CAPITAL LETTER E WITH CARON
-<U011A> <U0045>
-% LATIN SMALL LETTER E WITH CARON
-<U011B> <U0065>
-% LATIN CAPITAL LETTER G WITH CIRCUMFLEX
-<U011C> "<U0047><U0068>";<U0047>
-% LATIN SMALL LETTER G WITH CIRCUMFLEX
-<U011D> "<U0067><U0068>";<U0067>
-% LATIN CAPITAL LETTER G WITH BREVE
-<U011E> <U0047>
-% LATIN SMALL LETTER G WITH BREVE
-<U011F> <U0067>
-% LATIN CAPITAL LETTER G WITH DOT ABOVE
-<U0120> <U0047>
-% LATIN SMALL LETTER G WITH DOT ABOVE
-<U0121> <U0067>
-% LATIN CAPITAL LETTER G WITH CEDILLA
-<U0122> <U0047>
-% LATIN SMALL LETTER G WITH CEDILLA
-<U0123> <U0067>
-% LATIN CAPITAL LETTER H WITH CIRCUMFLEX
-<U0124> "<U0048><U0068>";<U0048>
-% LATIN SMALL LETTER H WITH CIRCUMFLEX
-<U0125> "<U0068><U0068>";<U0068>
-% LATIN CAPITAL LETTER H WITH STROKE
-<U0126> <U0048>
-% LATIN SMALL LETTER H WITH STROKE
-<U0127> <U0068>
-% LATIN CAPITAL LETTER I WITH TILDE
-<U0128> <U0049>
-% LATIN SMALL LETTER I WITH TILDE
-<U0129> <U0069>
-% LATIN CAPITAL LETTER I WITH MACRON
-<U012A> <U0049>
-% LATIN SMALL LETTER I WITH MACRON
-<U012B> <U0069>
-% LATIN CAPITAL LETTER I WITH BREVE
-<U012C> <U0049>
-% LATIN SMALL LETTER I WITH BREVE
-<U012D> <U0069>
-% LATIN CAPITAL LETTER I WITH OGONEK
-<U012E> <U0049>
-% LATIN SMALL LETTER I WITH OGONEK
-<U012F> <U0069>
-% LATIN CAPITAL LETTER I WITH DOT ABOVE
-<U0130> <U0049>
-% LATIN SMALL LETTER DOTLESS I
-<U0131> <U0069>
-% LATIN CAPITAL LIGATURE IJ
-<U0132> "<U0049><U004A>"
-% LATIN SMALL LIGATURE IJ
-<U0133> "<U0069><U006A>"
-% LATIN CAPITAL LETTER J WITH CIRCUMFLEX
-<U0134> "<U004A><U0068>";<U004A>
-% LATIN SMALL LETTER J WITH CIRCUMFLEX
-<U0135> "<U006A><U0068>";<U006A>
-% LATIN CAPITAL LETTER K WITH CEDILLA
-<U0136> <U004B>
-% LATIN SMALL LETTER K WITH CEDILLA
-<U0137> <U006B>
-% LATIN SMALL LETTER KRA
-<U0138> <U006B>
-% LATIN CAPITAL LETTER L WITH ACUTE
-<U0139> <U004C>
-% LATIN SMALL LETTER L WITH ACUTE
-<U013A> <U006C>
-% LATIN CAPITAL LETTER L WITH CEDILLA
-<U013B> <U004C>
-% LATIN SMALL LETTER L WITH CEDILLA
-<U013C> <U006C>
-% LATIN CAPITAL LETTER L WITH CARON
-<U013D> <U004C>
-% LATIN SMALL LETTER L WITH CARON
-<U013E> <U006C>
-% LATIN CAPITAL LETTER L WITH MIDDLE DOT
-<U013F>
"<U004C><U00B7>";"<U004C><U002E>";<U004C>
-% LATIN SMALL LETTER L WITH MIDDLE DOT
-<U0140>
"<U006C><U00B7>";"<U006C><U002E>";<U006C>
-% LATIN CAPITAL LETTER L WITH STROKE
-<U0141> <U004C>
-% LATIN SMALL LETTER L WITH STROKE
-<U0142> <U006C>
-% LATIN CAPITAL LETTER N WITH ACUTE
-<U0143> <U004E>
-% LATIN SMALL LETTER N WITH ACUTE
-<U0144> <U006E>
-% LATIN CAPITAL LETTER N WITH CEDILLA
-<U0145> <U004E>
-% LATIN SMALL LETTER N WITH CEDILLA
-<U0146> <U006E>
-% LATIN CAPITAL LETTER N WITH CARON
-<U0147> <U004E>
-% LATIN SMALL LETTER N WITH CARON
-<U0148> <U006E>
-% LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
-<U0149> "<U0027><U006E>"
-% LATIN CAPITAL LETTER ENG
-<U014A> "<U004E><U0047>";<U004E>
-% LATIN SMALL LETTER ENG
-<U014B> "<U006E><U0067>";<U006E>
-% LATIN CAPITAL LETTER O WITH MACRON
-<U014C> <U004F>
-% LATIN SMALL LETTER O WITH MACRON
-<U014D> <U006F>
-% LATIN CAPITAL LETTER O WITH BREVE
-<U014E> <U004F>
-% LATIN SMALL LETTER O WITH BREVE
-<U014F> <U006F>
-% LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
-<U0150> <U004F>
-% LATIN SMALL LETTER O WITH DOUBLE ACUTE
-<U0151> <U006F>
-% LATIN CAPITAL LIGATURE OE
-<U0152> <U009A>;"<U004F><U0045>"
-% LATIN SMALL LIGATURE OE
-<U0153> <U009B>;"<U006F><U0065>"
-% LATIN CAPITAL LETTER R WITH ACUTE
-<U0154> <U0052>
-% LATIN SMALL LETTER R WITH ACUTE
-<U0155> <U0072>
-% LATIN CAPITAL LETTER R WITH CEDILLA
-<U0156> <U0052>
-% LATIN SMALL LETTER R WITH CEDILLA
-<U0157> <U0072>
-% LATIN CAPITAL LETTER R WITH CARON
-<U0158> <U0052>
-% LATIN SMALL LETTER R WITH CARON
-<U0159> <U0072>
-% LATIN CAPITAL LETTER S WITH ACUTE
-<U015A> <U0053>
-% LATIN SMALL LETTER S WITH ACUTE
-<U015B> <U0073>
-% LATIN CAPITAL LETTER S WITH CIRCUMFLEX
-<U015C> "<U0053><U0068>";<U0053>
-% LATIN SMALL LETTER S WITH CIRCUMFLEX
-<U015D> "<U0073><U0068>";<U0073>
-% LATIN CAPITAL LETTER S WITH CEDILLA
-<U015E> <U0053>
-% LATIN SMALL LETTER S WITH CEDILLA
-<U015F> <U0073>
-% LATIN CAPITAL LETTER S WITH CARON
-<U0160> <U0053>
-% LATIN SMALL LETTER S WITH CARON
-<U0161> <U0073>
-% LATIN CAPITAL LETTER T WITH CEDILLA
-<U0162> <U0054>
-% LATIN SMALL LETTER T WITH CEDILLA
-<U0163> <U0074>
-% LATIN CAPITAL LETTER T WITH CARON
-<U0164> <U0054>
-% LATIN SMALL LETTER T WITH CARON
-<U0165> <U0074>
-% LATIN CAPITAL LETTER T WITH STROKE
-<U0166> <U0054>
-% LATIN SMALL LETTER T WITH STROKE
-<U0167> <U0074>
-% LATIN CAPITAL LETTER U WITH TILDE
-<U0168> <U0055>
-% LATIN SMALL LETTER U WITH TILDE
-<U0169> <U0075>
-% LATIN CAPITAL LETTER U WITH MACRON
-<U016A> <U0055>
-% LATIN SMALL LETTER U WITH MACRON
-<U016B> <U0075>
-% LATIN CAPITAL LETTER U WITH BREVE
-<U016C> <U0055>
-% LATIN SMALL LETTER U WITH BREVE
-<U016D> <U0075>
-% LATIN CAPITAL LETTER U WITH RING ABOVE
-<U016E> <U0055>
-% LATIN SMALL LETTER U WITH RING ABOVE
-<U016F> <U0075>
-% LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
-<U0170> <U0055>
-% LATIN SMALL LETTER U WITH DOUBLE ACUTE
-<U0171> <U0075>
-% LATIN CAPITAL LETTER U WITH OGONEK
-<U0172> <U0055>
-% LATIN SMALL LETTER U WITH OGONEK
-<U0173> <U0075>
-% LATIN CAPITAL LETTER W WITH CIRCUMFLEX
-<U0174> <U0081>;<U0057>
-% LATIN SMALL LETTER W WITH CIRCUMFLEX
-<U0175> <U0082>;<U0077>
-% LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
-<U0176> <U0085>;<U0059>
-% LATIN SMALL LETTER Y WITH CIRCUMFLEX
-<U0177> <U0086>;<U0079>
-% LATIN CAPITAL LETTER Y WITH DIAERESIS
-<U0178> <U0059>
-% LATIN CAPITAL LETTER Z WITH ACUTE
-<U0179> <U005A>
-% LATIN SMALL LETTER Z WITH ACUTE
-<U017A> <U007A>
-% LATIN CAPITAL LETTER Z WITH DOT ABOVE
-<U017B> <U005A>
-% LATIN SMALL LETTER Z WITH DOT ABOVE
-<U017C> <U007A>
-% LATIN CAPITAL LETTER Z WITH CARON
-<U017D> <U005A>
-% LATIN SMALL LETTER Z WITH CARON
-<U017E> <U007A>
-% LATIN SMALL LETTER LONG S
-<U017F> <U0073>
-% LATIN SMALL LETTER F WITH HOOK
-<U0192> <U0066>
-% LATIN CAPITAL LETTER S WITH COMMA BELOW
-<U0218> <U015E>;<U0053>
-% LATIN SMALL LETTER S WITH COMMA BELOW
-<U0219> <U015F>;<U0073>
-% LATIN CAPITAL LETTER T WITH COMMA BELOW
-<U021A> <U0162>;<U0054>
-% LATIN SMALL LETTER T WITH COMMA BELOW
-<U021B> <U0163>;<U0074>
-% MODIFIER LETTER PRIME
-<U02B9> <U2032>;<U0027>
-% MODIFIER LETTER TURNED COMMA
-<U02BB> <U2018>
-% MODIFIER LETTER APOSTROPHE
-<U02BC> <U2019>;<U0027>
-% MODIFIER LETTER REVERSED COMMA
-<U02BD> <U201B>
-% MODIFIER LETTER CIRCUMFLEX ACCENT
-<U02C6> <U005E>
-% MODIFIER LETTER VERTICAL LINE
-<U02C8> <U0027>
-% MODIFIER LETTER MACRON
-<U02C9> <U00AF>
-% MODIFIER LETTER LOW VERTICAL LINE
-<U02CC> <U002C>
-% MODIFIER LETTER TRIANGULAR COLON
-<U02D0> <U003A>
-% RING ABOVE
-<U02DA> <U00B0>
-% SMALL TILDE
-<U02DC> <U007E>
-% DOUBLE ACUTE ACCENT
-<U02DD> <U0022>
-% GREEK NUMERAL SIGN
-<U0374> <U0027>
-% GREEK LOWER NUMERAL SIGN
-<U0375> <U002C>
-% GREEK QUESTION MARK
-<U037E> <U003B>
-% LATIN CAPITAL LETTER B WITH DOT ABOVE
-<U1E02> <U0042>
-% LATIN SMALL LETTER B WITH DOT ABOVE
-<U1E03> <U0062>
-% LATIN CAPITAL LETTER D WITH DOT ABOVE
-<U1E0A> <U0044>
-% LATIN SMALL LETTER D WITH DOT ABOVE
-<U1E0B> <U0064>
-% LATIN CAPITAL LETTER F WITH DOT ABOVE
-<U1E1E> <U0046>
-% LATIN SMALL LETTER F WITH DOT ABOVE
-<U1E1F> <U0066>
-% LATIN CAPITAL LETTER M WITH DOT ABOVE
-<U1E40> <U004D>
-% LATIN SMALL LETTER M WITH DOT ABOVE
-<U1E41> <U006D>
-% LATIN CAPITAL LETTER P WITH DOT ABOVE
-<U1E56> <U0050>
-% LATIN SMALL LETTER P WITH DOT ABOVE
-<U1E57> <U0070>
-% LATIN CAPITAL LETTER S WITH DOT ABOVE
-<U1E60> <U0053>
-% LATIN SMALL LETTER S WITH DOT ABOVE
-<U1E61> <U0073>
-% LATIN CAPITAL LETTER T WITH DOT ABOVE
-<U1E6A> <U0054>
-% LATIN SMALL LETTER T WITH DOT ABOVE
-<U1E6B> <U0074>
-% LATIN CAPITAL LETTER W WITH GRAVE
-<U1E80> <U0057>
-% LATIN SMALL LETTER W WITH GRAVE
-<U1E81> <U0077>
-% LATIN CAPITAL LETTER W WITH ACUTE
-<U1E82> <U0057>
-% LATIN SMALL LETTER W WITH ACUTE
-<U1E83> <U0077>
-% LATIN CAPITAL LETTER W WITH DIAERESIS
-<U1E84> <U0057>
-% LATIN SMALL LETTER W WITH DIAERESIS
-<U1E85> <U0077>
-% LATIN CAPITAL LETTER Y WITH GRAVE
-<U1EF2> <U0059>
-% LATIN SMALL LETTER Y WITH GRAVE
-<U1EF3> <U0079>
-% EN QUAD
-<U2000> <U0020>
-% EM QUAD
-<U2001> "<U0020><U0020>"
-% EN SPACE
-<U2002> <U0020>
-% EM SPACE
-<U2003> "<U0020><U0020>"
-% THREE-PER-EM SPACE
-<U2004> <U0020>
-% FOUR-PER-EM SPACE
-<U2005> <U0020>
-% SIX-PER-EM SPACE
-<U2006> <U0020>
-% FIGURE SPACE
-<U2007> <U0020>
-% PUNCTUATION SPACE
-<U2008> <U0020>
-% THIN SPACE
-<U2009> <U0020>
-% HAIR SPACE
-<U200A> ""
-% ZERO WIDTH SPACE
-<U200B> ""
-% ZERO WIDTH NON-JOINER
-<U200C> ""
-% ZERO WIDTH JOINER
-<U200D> ""
-% LEFT-TO-RIGHT MARK
-<U200E> ""
-% RIGHT-TO-LEFT MARK
-<U200F> ""
-% HYPHEN
-<U2010> <U002D>
-% NON-BREAKING HYPHEN
-<U2011> <U002D>
-% FIGURE DASH
-<U2012> <U002D>
-% EN DASH
-<U2013> <U0097>;<U002D>
-% EM DASH
-<U2014> <U0098>;"<U002D><U002D>"
-% HORIZONTAL BAR
-<U2015> "<U002D><U002D>"
-% DOUBLE VERTICAL LINE
-<U2016> "<U007C><U007C>"
-% DOUBLE LOW LINE
-<U2017> <U005F>
-% LEFT SINGLE QUOTATION MARK
-<U2018> <U0090>;<U0027>
-% RIGHT SINGLE QUOTATION MARK
-<U2019> <U0091>;<U0027>
-% SINGLE LOW-9 QUOTATION MARK
-<U201A> <U0027>
-% SINGLE HIGH-REVERSED-9 QUOTATION MARK
-<U201B> <U0027>
-% LEFT DOUBLE QUOTATION MARK
-<U201C> <U0094>;<U0022>
-% RIGHT DOUBLE QUOTATION MARK
-<U201D> <U0095>;<U0022>
-% DOUBLE LOW-9 QUOTATION MARK
-<U201E> <U0096>;<U0022>
-% DOUBLE HIGH-REVERSED-9 QUOTATION MARK
-<U201F> <U0022>
-% DAGGER
-<U2020> <U009C>;<U002B>
-% DOUBLE DAGGER
-<U2021> <U009D>;"<U002B><U002B>"
-% BULLET
-<U2022> <U008F>;<U006F>
-% TRIANGULAR BULLET
-<U2023> <U003E>
-% ONE DOT LEADER
-<U2024> <U002E>
-% TWO DOT LEADER
-<U2025> "<U002E><U002E>"
-% HORIZONTAL ELLIPSIS
-<U2026> <U008C>;"<U002E><U002E><U002E>"
-% HYPHENATION POINT
-<U2027> <U002D>
-% LEFT-TO-RIGHT EMBEDDING
-<U202A> ""
-% RIGHT-TO-LEFT EMBEDDING
-<U202B> ""
-% POP DIRECTIONAL FORMATTING
-<U202C> ""
-% LEFT-TO-RIGHT OVERRIDE
-<U202D> ""
-% RIGHT-TO-LEFT OVERRIDE
-<U202E> ""
-% NARROW NO-BREAK SPACE
-<U202F> <U0020>
-% PER MILLE SIGN
-<U2030>
<U008E>;"<U0020><U0030><U002F><U0030><U0030>"
-% PRIME
-<U2032> <U0027>
-% DOUBLE PRIME
-<U2033> <U0022>
-% TRIPLE PRIME
-<U2034> "<U0027><U0027><U0027>"
-% REVERSED PRIME
-<U2035> <U0060>
-% REVERSED DOUBLE PRIME
-<U2036> "<U0060><U0060>"
-% REVERSED TRIPLE PRIME
-<U2037> "<U0060><U0060><U0060>"
-% SINGLE LEFT-POINTING ANGLE QUOTATION MARK
-<U2039> <U0092>;<U003C>
-% SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
-<U203A> <U0093>;<U003E>
-% DOUBLE EXCLAMATION MARK
-<U203C> "<U0021><U0021>"
-% OVERLINE
-<U203E> <U002D>
-% HYPHEN BULLET
-<U2043> <U002D>
-% FRACTION SLASH
-<U2044> <U002F>
-% QUESTION EXCLAMATION MARK
-<U2048> "<U003F><U0021>"
-% EXCLAMATION QUESTION MARK
-<U2049> "<U0021><U003F>"
-% TIRONIAN SIGN ET
-<U204A> <U0037>
-% SUPERSCRIPT ZERO
-<U2070> "<U005E><U0030>";<U0030>
-% SUPERSCRIPT FOUR
-<U2074> "<U005E><U0034>";<U0034>
-% SUPERSCRIPT FIVE
-<U2075> "<U005E><U0035>";<U0035>
-% SUPERSCRIPT SIX
-<U2076> "<U005E><U0036>";<U0036>
-% SUPERSCRIPT SEVEN
-<U2077> "<U005E><U0037>";<U0037>
-% SUPERSCRIPT EIGHT
-<U2078> "<U005E><U0038>";<U0038>
-% SUPERSCRIPT NINE
-<U2079> "<U005E><U0039>";<U0039>
-% SUPERSCRIPT PLUS SIGN
-<U207A> "<U005E><U002B>";<U002B>
-% SUPERSCRIPT MINUS
-<U207B> "<U005E><U002D>";<U002D>
-% SUPERSCRIPT EQUALS SIGN
-<U207C> "<U005E><U003D>";<U003D>
-% SUPERSCRIPT LEFT PARENTHESIS
-<U207D> "<U005E><U0028>";<U0028>
-% SUPERSCRIPT RIGHT PARENTHESIS
-<U207E> "<U005E><U0029>";<U0029>
-% SUPERSCRIPT LATIN SMALL LETTER N
-<U207F> "<U005E><U006E>";<U006E>
-% SUBSCRIPT ZERO
-<U2080> "<U005F><U0030>";<U0030>
-% SUBSCRIPT ONE
-<U2081> "<U005F><U0031>";<U0031>
-% SUBSCRIPT TWO
-<U2082> "<U005F><U0032>";<U0032>
-% SUBSCRIPT THREE
-<U2083> "<U005F><U0033>";<U0033>
-% SUBSCRIPT FOUR
-<U2084> "<U005F><U0034>";<U0034>
-% SUBSCRIPT FIVE
-<U2085> "<U005F><U0035>";<U0035>
-% SUBSCRIPT SIX
-<U2086> "<U005F><U0036>";<U0036>
-% SUBSCRIPT SEVEN
-<U2087> "<U005F><U0037>";<U0037>
-% SUBSCRIPT EIGHT
-<U2088> "<U005F><U0038>";<U0038>
-% SUBSCRIPT NINE
-<U2089> "<U005F><U0039>";<U0039>
-% SUBSCRIPT PLUS SIGN
-<U208A> "<U005F><U002B>";<U002B>
-% SUBSCRIPT MINUS
-<U208B> "<U005F><U002D>";<U002D>
-% SUBSCRIPT EQUALS SIGN
-<U208C> "<U005F><U003D>";<U003D>
-% SUBSCRIPT LEFT PARENTHESIS
-<U208D> "<U005F><U0028>";<U0028>
-% SUBSCRIPT RIGHT PARENTHESIS
-<U208E> "<U005F><U0029>";<U0029>
-% EURO SIGN
-<U20AC>
<U0080>;"<U0045><U0055><U0052>";<U0045>
-% ACCOUNT OF
-<U2100> "<U0061><U002F><U0063>"
-% ADDRESSED TO THE SUBJECT
-<U2101> "<U0061><U002F><U0073>"
-% DEGREE CELSIUS
-<U2103> "<U00B0><U0043>";<U0043>
-% CARE OF
-<U2105> "<U0063><U002F><U006F>"
-% CADA UNA
-<U2106> "<U0063><U002F><U0075>"
-% DEGREE FAHRENHEIT
-<U2109> "<U00B0><U0046>";<U0046>
-% SCRIPT SMALL L
-<U2113> <U006C>
-% NUMERO SIGN
-<U2116>
"<U004E><U00BA>";"<U004E><U006F>"
-% SOUND RECORDING COPYRIGHT
-<U2117> "<U0028><U0050><U0029>"
-% SERVICE MARK
-<U2120> "<U005B><U0053><U004D><U005D>"
-% TELEPHONE SIGN
-<U2121> "<U0054><U0045><U004C>"
-% TRADE MARK SIGN
-<U2122>
<U008D>;"<U005B><U0054><U004D><U005D>"
-% OHM SIGN
-<U2126>
<U03A9>;"<U006F><U0068><U006D>";<U004F>
-% KELVIN SIGN
-<U212A> <U004B>
-% ANGSTROM SIGN
-<U212B> <U00C5>
-% ESTIMATED SYMBOL
-<U212E> <U0065>
-% VULGAR FRACTION ONE THIRD
-<U2153> "<U0020><U0031><U002F><U0033>"
-% VULGAR FRACTION TWO THIRDS
-<U2154> "<U0020><U0032><U002F><U0033>"
-% VULGAR FRACTION ONE FIFTH
-<U2155> "<U0020><U0031><U002F><U0035>"
-% VULGAR FRACTION TWO FIFTHS
-<U2156> "<U0020><U0032><U002F><U0035>"
-% VULGAR FRACTION THREE FIFTHS
-<U2157> "<U0020><U0033><U002F><U0035>"
-% VULGAR FRACTION FOUR FIFTHS
-<U2158> "<U0020><U0034><U002F><U0035>"
-% VULGAR FRACTION ONE SIXTH
-<U2159> "<U0020><U0031><U002F><U0036>"
-% VULGAR FRACTION FIVE SIXTHS
-<U215A> "<U0020><U0035><U002F><U0036>"
-% VULGAR FRACTION ONE EIGHTH
-<U215B> "<U0020><U0031><U002F><U0038>"
-% VULGAR FRACTION THREE EIGHTHS
-<U215C> "<U0020><U0033><U002F><U0038>"
-% VULGAR FRACTION FIVE EIGHTHS
-<U215D> "<U0020><U0035><U002F><U0038>"
-% VULGAR FRACTION SEVEN EIGHTHS
-<U215E> "<U0020><U0037><U002F><U0038>"
-% FRACTION NUMERATOR ONE
-<U215F> "<U0020><U0031><U002F>"
-% ROMAN NUMERAL ONE
-<U2160> <U0049>
-% ROMAN NUMERAL TWO
-<U2161> "<U0049><U0049>"
-% ROMAN NUMERAL THREE
-<U2162> "<U0049><U0049><U0049>"
-% ROMAN NUMERAL FOUR
-<U2163> "<U0049><U0056>"
-% ROMAN NUMERAL FIVE
-<U2164> <U0056>
-% ROMAN NUMERAL SIX
-<U2165> "<U0056><U0049>"
-% ROMAN NUMERAL SEVEN
-<U2166> "<U0056><U0049><U0049>"
-% ROMAN NUMERAL EIGHT
-<U2167> "<U0056><U0049><U0049><U0049>"
-% ROMAN NUMERAL NINE
-<U2168> "<U0049><U0058>"
-% ROMAN NUMERAL TEN
-<U2169> <U0058>
-% ROMAN NUMERAL ELEVEN
-<U216A> "<U0058><U0049>"
-% ROMAN NUMERAL TWELVE
-<U216B> "<U0058><U0049><U0049>"
-% ROMAN NUMERAL FIFTY
-<U216C> <U004C>
-% ROMAN NUMERAL ONE HUNDRED
-<U216D> <U0043>
-% ROMAN NUMERAL FIVE HUNDRED
-<U216E> <U0044>
-% ROMAN NUMERAL ONE THOUSAND
-<U216F> <U004D>
-% SMALL ROMAN NUMERAL ONE
-<U2170> <U0069>
-% SMALL ROMAN NUMERAL TWO
-<U2171> "<U0069><U0069>"
-% SMALL ROMAN NUMERAL THREE
-<U2172> "<U0069><U0069><U0069>"
-% SMALL ROMAN NUMERAL FOUR
-<U2173> "<U0069><U0076>"
-% SMALL ROMAN NUMERAL FIVE
-<U2174> <U0076>
-% SMALL ROMAN NUMERAL SIX
-<U2175> "<U0076><U0069>"
-% SMALL ROMAN NUMERAL SEVEN
-<U2176> "<U0076><U0069><U0069>"
-% SMALL ROMAN NUMERAL EIGHT
-<U2177> "<U0076><U0069><U0069><U0069>"
-% SMALL ROMAN NUMERAL NINE
-<U2178> "<U0069><U0078>"
-% SMALL ROMAN NUMERAL TEN
-<U2179> <U0078>
-% SMALL ROMAN NUMERAL ELEVEN
-<U217A> "<U0078><U0069>"
-% SMALL ROMAN NUMERAL TWELVE
-<U217B> "<U0078><U0069><U0069>"
-% SMALL ROMAN NUMERAL FIFTY
-<U217C> <U006C>
-% SMALL ROMAN NUMERAL ONE HUNDRED
-<U217D> <U0063>
-% SMALL ROMAN NUMERAL FIVE HUNDRED
-<U217E> <U0064>
-% SMALL ROMAN NUMERAL ONE THOUSAND
-<U217F> <U006D>
-% LEFTWARDS ARROW
-<U2190> "<U003C><U002D>"
-% UPWARDS ARROW
-<U2191> <U005E>
-% RIGHTWARDS ARROW
-<U2192> "<U002D><U003E>"
-% DOWNWARDS ARROW
-<U2193> <U0076>
-% LEFT RIGHT ARROW
-<U2194> "<U003C><U002D><U003E>"
-% LEFTWARDS DOUBLE ARROW
-<U21D0> "<U003C><U003D>"
-% RIGHTWARDS DOUBLE ARROW
-<U21D2> "<U003D><U003E>"
-% LEFT RIGHT DOUBLE ARROW
-<U21D4> "<U003C><U003D><U003E>"
-% MINUS SIGN
-<U2212> <U0099>;<U2013>;<U002D>
-% DIVISION SLASH
-<U2215> <U002F>
-% SET MINUS
-<U2216> <U005C>
-% ASTERISK OPERATOR
-<U2217> <U002A>
-% RING OPERATOR
-<U2218> <U006F>
-% BULLET OPERATOR
-<U2219> <U00B7>
-% INFINITY
-<U221E> "<U0069><U006E><U0066>"
-% DIVIDES
-<U2223> <U007C>
-% PARALLEL TO
-<U2225> "<U007C><U007C>"
-% RATIO
-<U2236> <U003A>
-% TILDE OPERATOR
-<U223C> <U007E>
-% NOT EQUAL TO
-<U2260> "<U002F><U003D>"
-% IDENTICAL TO
-<U2261> <U003D>
-% LESS-THAN OR EQUAL TO
-<U2264> "<U003C><U003D>"
-% GREATER-THAN OR EQUAL TO
-<U2265> "<U003E><U003D>"
-% MUCH LESS-THAN
-<U226A> "<U003C><U003C>"
-% MUCH GREATER-THAN
-<U226B> "<U003E><U003E>"
-% CIRCLED PLUS
-<U2295> "<U0028><U002B><U0029>"
-% CIRCLED MINUS
-<U2296> "<U0028><U002D><U0029>"
-% CIRCLED TIMES
-<U2297> "<U0028><U0078><U0029>"
-% CIRCLED DIVISION SLASH
-<U2298> "<U0028><U002F><U0029>"
-% RIGHT TACK
-<U22A2> "<U007C><U002D>"
-% LEFT TACK
-<U22A3> "<U002D><U007C>"
-% ASSERTION
-<U22A6> "<U007C><U002D>"
-% MODELS
-<U22A7> "<U007C><U003D>"
-% TRUE
-<U22A8> "<U007C><U003D>"
-% FORCES
-<U22A9> "<U007C><U007C><U002D>"
-% DOT OPERATOR
-<U22C5> <U00B7>
-% STAR OPERATOR
-<U22C6> <U002A>
-% EQUAL AND PARALLEL TO
-<U22D5> <U0023>
-% VERY MUCH LESS-THAN
-<U22D8> "<U003C><U003C><U003C>"
-% VERY MUCH GREATER-THAN
-<U22D9> "<U003E><U003E><U003E>"
-% MIDLINE HORIZONTAL ELLIPSIS
-<U22EF> "<U002E><U002E><U002E>"
-% LEFT-POINTING ANGLE BRACKET
-<U2329> <U003C>
-% RIGHT-POINTING ANGLE BRACKET
-<U232A> <U003E>
-% SYMBOL FOR NULL
-<U2400> "<U004E><U0055><U004C>"
-% SYMBOL FOR START OF HEADING
-<U2401> "<U0053><U004F><U0048>"
-% SYMBOL FOR START OF TEXT
-<U2402> "<U0053><U0054><U0058>"
-% SYMBOL FOR END OF TEXT
-<U2403> "<U0045><U0054><U0058>"
-% SYMBOL FOR END OF TRANSMISSION
-<U2404> "<U0045><U004F><U0054>"
-% SYMBOL FOR ENQUIRY
-<U2405> "<U0045><U004E><U0051>"
-% SYMBOL FOR ACKNOWLEDGE
-<U2406> "<U0041><U0043><U004B>"
-% SYMBOL FOR BELL
-<U2407> "<U0042><U0045><U004C>"
-% SYMBOL FOR BACKSPACE
-<U2408> "<U0042><U0053>"
-% SYMBOL FOR HORIZONTAL TABULATION
-<U2409> "<U0048><U0054>"
-% SYMBOL FOR LINE FEED
-<U240A> "<U004C><U0046>"
-% SYMBOL FOR VERTICAL TABULATION
-<U240B> "<U0056><U0054>"
-% SYMBOL FOR FORM FEED
-<U240C> "<U0046><U0046>"
-% SYMBOL FOR CARRIAGE RETURN
-<U240D> "<U0043><U0052>"
-% SYMBOL FOR SHIFT OUT
-<U240E> "<U0053><U004F>"
-% SYMBOL FOR SHIFT IN
-<U240F> "<U0053><U0049>"
-% SYMBOL FOR DATA LINK ESCAPE
-<U2410> "<U0044><U004C><U0045>"
-% SYMBOL FOR DEVICE CONTROL ONE
-<U2411> "<U0044><U0043><U0031>"
-% SYMBOL FOR DEVICE CONTROL TWO
-<U2412> "<U0044><U0043><U0032>"
-% SYMBOL FOR DEVICE CONTROL THREE
-<U2413> "<U0044><U0043><U0033>"
-% SYMBOL FOR DEVICE CONTROL FOUR
-<U2414> "<U0044><U0043><U0034>"
-% SYMBOL FOR NEGATIVE ACKNOWLEDGE
-<U2415> "<U004E><U0041><U004B>"
-% SYMBOL FOR SYNCHRONOUS IDLE
-<U2416> "<U0053><U0059><U004E>"
-% SYMBOL FOR END OF TRANSMISSION BLOCK
-<U2417> "<U0045><U0054><U0042>"
-% SYMBOL FOR CANCEL
-<U2418> "<U0043><U0041><U004E>"
-% SYMBOL FOR END OF MEDIUM
-<U2419> "<U0045><U004D>"
-% SYMBOL FOR SUBSTITUTE
-<U241A> "<U0053><U0055><U0042>"
-% SYMBOL FOR ESCAPE
-<U241B> "<U0045><U0053><U0043>"
-% SYMBOL FOR FILE SEPARATOR
-<U241C> "<U0046><U0053>"
-% SYMBOL FOR GROUP SEPARATOR
-<U241D> "<U0047><U0053>"
-% SYMBOL FOR RECORD SEPARATOR
-<U241E> "<U0052><U0053>"
-% SYMBOL FOR UNIT SEPARATOR
-<U241F> "<U0055><U0053>"
-% SYMBOL FOR SPACE
-<U2420> "<U0053><U0050>"
-% SYMBOL FOR DELETE
-<U2421> "<U0044><U0045><U004C>"
-% OPEN BOX
-<U2423> <U005F>
-% SYMBOL FOR NEWLINE
-<U2424> "<U004E><U004C>"
-% SYMBOL FOR DELETE FORM TWO
-<U2425> "<U002F><U002F><U002F>"
-% SYMBOL FOR SUBSTITUTE FORM TWO
-<U2426> <U003F>
-% CIRCLED DIGIT ONE
-<U2460> "<U0028><U0031><U0029>";<U0031>
-% CIRCLED DIGIT TWO
-<U2461> "<U0028><U0032><U0029>";<U0032>
-% CIRCLED DIGIT THREE
-<U2462> "<U0028><U0033><U0029>";<U0033>
-% CIRCLED DIGIT FOUR
-<U2463> "<U0028><U0034><U0029>";<U0034>
-% CIRCLED DIGIT FIVE
-<U2464> "<U0028><U0035><U0029>";<U0035>
-% CIRCLED DIGIT SIX
-<U2465> "<U0028><U0036><U0029>";<U0036>
-% CIRCLED DIGIT SEVEN
-<U2466> "<U0028><U0037><U0029>";<U0037>
-% CIRCLED DIGIT EIGHT
-<U2467> "<U0028><U0038><U0029>";<U0038>
-% CIRCLED DIGIT NINE
-<U2468> "<U0028><U0039><U0029>";<U0039>
-% CIRCLED NUMBER TEN
-<U2469> "<U0028><U0031><U0030><U0029>"
-% CIRCLED NUMBER ELEVEN
-<U246A> "<U0028><U0031><U0031><U0029>"
-% CIRCLED NUMBER TWELVE
-<U246B> "<U0028><U0031><U0032><U0029>"
-% CIRCLED NUMBER THIRTEEN
-<U246C> "<U0028><U0031><U0033><U0029>"
-% CIRCLED NUMBER FOURTEEN
-<U246D> "<U0028><U0031><U0034><U0029>"
-% CIRCLED NUMBER FIFTEEN
-<U246E> "<U0028><U0031><U0035><U0029>"
-% CIRCLED NUMBER SIXTEEN
-<U246F> "<U0028><U0031><U0036><U0029>"
-% CIRCLED NUMBER SEVENTEEN
-<U2470> "<U0028><U0031><U0037><U0029>"
-% CIRCLED NUMBER EIGHTEEN
-<U2471> "<U0028><U0031><U0038><U0029>"
-% CIRCLED NUMBER NINETEEN
-<U2472> "<U0028><U0031><U0039><U0029>"
-% CIRCLED NUMBER TWENTY
-<U2473> "<U0028><U0032><U0030><U0029>"
-% PARENTHESIZED DIGIT ONE
-<U2474> "<U0028><U0031><U0029>";<U0031>
-% PARENTHESIZED DIGIT TWO
-<U2475> "<U0028><U0032><U0029>";<U0032>
-% PARENTHESIZED DIGIT THREE
-<U2476> "<U0028><U0033><U0029>";<U0033>
-% PARENTHESIZED DIGIT FOUR
-<U2477> "<U0028><U0034><U0029>";<U0034>
-% PARENTHESIZED DIGIT FIVE
-<U2478> "<U0028><U0035><U0029>";<U0035>
-% PARENTHESIZED DIGIT SIX
-<U2479> "<U0028><U0036><U0029>";<U0036>
-% PARENTHESIZED DIGIT SEVEN
-<U247A> "<U0028><U0037><U0029>";<U0037>
-% PARENTHESIZED DIGIT EIGHT
-<U247B> "<U0028><U0038><U0029>";<U0038>
-% PARENTHESIZED DIGIT NINE
-<U247C> "<U0028><U0039><U0029>";<U0039>
-% PARENTHESIZED NUMBER TEN
-<U247D> "<U0028><U0031><U0030><U0029>"
-% PARENTHESIZED NUMBER ELEVEN
-<U247E> "<U0028><U0031><U0031><U0029>"
-% PARENTHESIZED NUMBER TWELVE
-<U247F> "<U0028><U0031><U0032><U0029>"
-% PARENTHESIZED NUMBER THIRTEEN
-<U2480> "<U0028><U0031><U0033><U0029>"
-% PARENTHESIZED NUMBER FOURTEEN
-<U2481> "<U0028><U0031><U0034><U0029>"
-% PARENTHESIZED NUMBER FIFTEEN
-<U2482> "<U0028><U0031><U0035><U0029>"
-% PARENTHESIZED NUMBER SIXTEEN
-<U2483> "<U0028><U0031><U0036><U0029>"
-% PARENTHESIZED NUMBER SEVENTEEN
-<U2484> "<U0028><U0031><U0037><U0029>"
-% PARENTHESIZED NUMBER EIGHTEEN
-<U2485> "<U0028><U0031><U0038><U0029>"
-% PARENTHESIZED NUMBER NINETEEN
-<U2486> "<U0028><U0031><U0039><U0029>"
-% PARENTHESIZED NUMBER TWENTY
-<U2487> "<U0028><U0032><U0030><U0029>"
-% DIGIT ONE FULL STOP
-<U2488> "<U0031><U002E>";<U0031>
-% DIGIT TWO FULL STOP
-<U2489> "<U0032><U002E>";<U0032>
-% DIGIT THREE FULL STOP
-<U248A> "<U0033><U002E>";<U0033>
-% DIGIT FOUR FULL STOP
-<U248B> "<U0034><U002E>";<U0034>
-% DIGIT FIVE FULL STOP
-<U248C> "<U0035><U002E>";<U0035>
-% DIGIT SIX FULL STOP
-<U248D> "<U0036><U002E>";<U0036>
-% DIGIT SEVEN FULL STOP
-<U248E> "<U0037><U002E>";<U0037>
-% DIGIT EIGHT FULL STOP
-<U248F> "<U0038><U002E>";<U0038>
-% DIGIT NINE FULL STOP
-<U2490> "<U0039><U002E>";<U0039>
-% NUMBER TEN FULL STOP
-<U2491> "<U0031><U0030><U002E>"
-% NUMBER ELEVEN FULL STOP
-<U2492> "<U0031><U0031><U002E>"
-% NUMBER TWELVE FULL STOP
-<U2493> "<U0031><U0032><U002E>"
-% NUMBER THIRTEEN FULL STOP
-<U2494> "<U0031><U0033><U002E>"
-% NUMBER FOURTEEN FULL STOP
-<U2495> "<U0031><U0034><U002E>"
-% NUMBER FIFTEEN FULL STOP
-<U2496> "<U0031><U0035><U002E>"
-% NUMBER SIXTEEN FULL STOP
-<U2497> "<U0031><U0036><U002E>"
-% NUMBER SEVENTEEN FULL STOP
-<U2498> "<U0031><U0037><U002E>"
-% NUMBER EIGHTEEN FULL STOP
-<U2499> "<U0031><U0038><U002E>"
-% NUMBER NINETEEN FULL STOP
-<U249A> "<U0031><U0039><U002E>"
-% NUMBER TWENTY FULL STOP
-<U249B> "<U0032><U0030><U002E>"
-% PARENTHESIZED LATIN SMALL LETTER A
-<U249C> "<U0028><U0061><U0029>";<U0061>
-% PARENTHESIZED LATIN SMALL LETTER B
-<U249D> "<U0028><U0062><U0029>";<U0062>
-% PARENTHESIZED LATIN SMALL LETTER C
-<U249E> "<U0028><U0063><U0029>";<U0063>
-% PARENTHESIZED LATIN SMALL LETTER D
-<U249F> "<U0028><U0064><U0029>";<U0064>
-% PARENTHESIZED LATIN SMALL LETTER E
-<U24A0> "<U0028><U0065><U0029>";<U0065>
-% PARENTHESIZED LATIN SMALL LETTER F
-<U24A1> "<U0028><U0066><U0029>";<U0066>
-% PARENTHESIZED LATIN SMALL LETTER G
-<U24A2> "<U0028><U0067><U0029>";<U0067>
-% PARENTHESIZED LATIN SMALL LETTER H
-<U24A3> "<U0028><U0068><U0029>";<U0068>
-% PARENTHESIZED LATIN SMALL LETTER I
-<U24A4> "<U0028><U0069><U0029>";<U0069>
-% PARENTHESIZED LATIN SMALL LETTER J
-<U24A5> "<U0028><U006A><U0029>";<U006A>
-% PARENTHESIZED LATIN SMALL LETTER K
-<U24A6> "<U0028><U006B><U0029>";<U006B>
-% PARENTHESIZED LATIN SMALL LETTER L
-<U24A7> "<U0028><U006C><U0029>";<U006C>
-% PARENTHESIZED LATIN SMALL LETTER M
-<U24A8> "<U0028><U006D><U0029>";<U006D>
-% PARENTHESIZED LATIN SMALL LETTER N
-<U24A9> "<U0028><U006E><U0029>";<U006E>
-% PARENTHESIZED LATIN SMALL LETTER O
-<U24AA> "<U0028><U006F><U0029>";<U006F>
-% PARENTHESIZED LATIN SMALL LETTER P
-<U24AB> "<U0028><U0070><U0029>";<U0070>
-% PARENTHESIZED LATIN SMALL LETTER Q
-<U24AC> "<U0028><U0071><U0029>";<U0071>
-% PARENTHESIZED LATIN SMALL LETTER R
-<U24AD> "<U0028><U0072><U0029>";<U0072>
-% PARENTHESIZED LATIN SMALL LETTER S
-<U24AE> "<U0028><U0073><U0029>";<U0073>
-% PARENTHESIZED LATIN SMALL LETTER T
-<U24AF> "<U0028><U0074><U0029>";<U0074>
-% PARENTHESIZED LATIN SMALL LETTER U
-<U24B0> "<U0028><U0075><U0029>";<U0075>
-% PARENTHESIZED LATIN SMALL LETTER V
-<U24B1> "<U0028><U0076><U0029>";<U0076>
-% PARENTHESIZED LATIN SMALL LETTER W
-<U24B2> "<U0028><U0077><U0029>";<U0077>
-% PARENTHESIZED LATIN SMALL LETTER X
-<U24B3> "<U0028><U0078><U0029>";<U0078>
-% PARENTHESIZED LATIN SMALL LETTER Y
-<U24B4> "<U0028><U0079><U0029>";<U0079>
-% PARENTHESIZED LATIN SMALL LETTER Z
-<U24B5> "<U0028><U007A><U0029>";<U007A>
-% CIRCLED LATIN CAPITAL LETTER A
-<U24B6> "<U0028><U0041><U0029>";<U0041>
-% CIRCLED LATIN CAPITAL LETTER B
-<U24B7> "<U0028><U0042><U0029>";<U0042>
-% CIRCLED LATIN CAPITAL LETTER C
-<U24B8> "<U0028><U0043><U0029>";<U0043>
-% CIRCLED LATIN CAPITAL LETTER D
-<U24B9> "<U0028><U0044><U0029>";<U0044>
-% CIRCLED LATIN CAPITAL LETTER E
-<U24BA> "<U0028><U0045><U0029>";<U0045>
-% CIRCLED LATIN CAPITAL LETTER F
-<U24BB> "<U0028><U0046><U0029>";<U0046>
-% CIRCLED LATIN CAPITAL LETTER G
-<U24BC> "<U0028><U0047><U0029>";<U0047>
-% CIRCLED LATIN CAPITAL LETTER H
-<U24BD> "<U0028><U0048><U0029>";<U0048>
-% CIRCLED LATIN CAPITAL LETTER I
-<U24BE> "<U0028><U0049><U0029>";<U0049>
-% CIRCLED LATIN CAPITAL LETTER J
-<U24BF> "<U0028><U004A><U0029>";<U004A>
-% CIRCLED LATIN CAPITAL LETTER K
-<U24C0> "<U0028><U004B><U0029>";<U004B>
-% CIRCLED LATIN CAPITAL LETTER L
-<U24C1> "<U0028><U004C><U0029>";<U004C>
-% CIRCLED LATIN CAPITAL LETTER M
-<U24C2> "<U0028><U004D><U0029>";<U004D>
-% CIRCLED LATIN CAPITAL LETTER N
-<U24C3> "<U0028><U004E><U0029>";<U004E>
-% CIRCLED LATIN CAPITAL LETTER O
-<U24C4> "<U0028><U004F><U0029>";<U004F>
-% CIRCLED LATIN CAPITAL LETTER P
-<U24C5> "<U0028><U0050><U0029>";<U0050>
-% CIRCLED LATIN CAPITAL LETTER Q
-<U24C6> "<U0028><U0051><U0029>";<U0051>
-% CIRCLED LATIN CAPITAL LETTER R
-<U24C7> "<U0028><U0052><U0029>";<U0052>
-% CIRCLED LATIN CAPITAL LETTER S
-<U24C8> "<U0028><U0053><U0029>";<U0053>
-% CIRCLED LATIN CAPITAL LETTER T
-<U24C9> "<U0028><U0054><U0029>";<U0054>
-% CIRCLED LATIN CAPITAL LETTER U
-<U24CA> "<U0028><U0055><U0029>";<U0055>
-% CIRCLED LATIN CAPITAL LETTER V
-<U24CB> "<U0028><U0056><U0029>";<U0056>
-% CIRCLED LATIN CAPITAL LETTER W
-<U24CC> "<U0028><U0057><U0029>";<U0057>
-% CIRCLED LATIN CAPITAL LETTER X
-<U24CD> "<U0028><U0058><U0029>";<U0058>
-% CIRCLED LATIN CAPITAL LETTER Y
-<U24CE> "<U0028><U0059><U0029>";<U0059>
-% CIRCLED LATIN CAPITAL LETTER Z
-<U24CF> "<U0028><U005A><U0029>";<U005A>
-% CIRCLED LATIN SMALL LETTER A
-<U24D0> "<U0028><U0061><U0029>";<U0061>
-% CIRCLED LATIN SMALL LETTER B
-<U24D1> "<U0028><U0062><U0029>";<U0062>
-% CIRCLED LATIN SMALL LETTER C
-<U24D2> "<U0028><U0063><U0029>";<U0063>
-% CIRCLED LATIN SMALL LETTER D
-<U24D3> "<U0028><U0064><U0029>";<U0064>
-% CIRCLED LATIN SMALL LETTER E
-<U24D4> "<U0028><U0065><U0029>";<U0065>
-% CIRCLED LATIN SMALL LETTER F
-<U24D5> "<U0028><U0066><U0029>";<U0066>
-% CIRCLED LATIN SMALL LETTER G
-<U24D6> "<U0028><U0067><U0029>";<U0067>
-% CIRCLED LATIN SMALL LETTER H
-<U24D7> "<U0028><U0068><U0029>";<U0068>
-% CIRCLED LATIN SMALL LETTER I
-<U24D8> "<U0028><U0069><U0029>";<U0069>
-% CIRCLED LATIN SMALL LETTER J
-<U24D9> "<U0028><U006A><U0029>";<U006A>
-% CIRCLED LATIN SMALL LETTER K
-<U24DA> "<U0028><U006B><U0029>";<U006B>
-% CIRCLED LATIN SMALL LETTER L
-<U24DB> "<U0028><U006C><U0029>";<U006C>
-% CIRCLED LATIN SMALL LETTER M
-<U24DC> "<U0028><U006D><U0029>";<U006D>
-% CIRCLED LATIN SMALL LETTER N
-<U24DD> "<U0028><U006E><U0029>";<U006E>
-% CIRCLED LATIN SMALL LETTER O
-<U24DE> "<U0028><U006F><U0029>";<U006F>
-% CIRCLED LATIN SMALL LETTER P
-<U24DF> "<U0028><U0070><U0029>";<U0070>
-% CIRCLED LATIN SMALL LETTER Q
-<U24E0> "<U0028><U0071><U0029>";<U0071>
-% CIRCLED LATIN SMALL LETTER R
-<U24E1> "<U0028><U0072><U0029>";<U0072>
-% CIRCLED LATIN SMALL LETTER S
-<U24E2> "<U0028><U0073><U0029>";<U0073>
-% CIRCLED LATIN SMALL LETTER T
-<U24E3> "<U0028><U0074><U0029>";<U0074>
-% CIRCLED LATIN SMALL LETTER U
-<U24E4> "<U0028><U0075><U0029>";<U0075>
-% CIRCLED LATIN SMALL LETTER V
-<U24E5> "<U0028><U0076><U0029>";<U0076>
-% CIRCLED LATIN SMALL LETTER W
-<U24E6> "<U0028><U0077><U0029>";<U0077>
-% CIRCLED LATIN SMALL LETTER X
-<U24E7> "<U0028><U0078><U0029>";<U0078>
-% CIRCLED LATIN SMALL LETTER Y
-<U24E8> "<U0028><U0079><U0029>";<U0079>
-% CIRCLED LATIN SMALL LETTER Z
-<U24E9> "<U0028><U007A><U0029>";<U007A>
-% CIRCLED DIGIT ZERO
-<U24EA> "<U0028><U0030><U0029>";<U0030>
-% BOX DRAWINGS LIGHT HORIZONTAL
-<U2500> <U002D>
-% BOX DRAWINGS HEAVY HORIZONTAL
-<U2501> <U003D>
-% BOX DRAWINGS LIGHT VERTICAL
-<U2502> <U007C>
-% BOX DRAWINGS HEAVY VERTICAL
-<U2503> <U007C>
-% BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL
-<U2504> <U002D>
-% BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL
-<U2505> <U003D>
-% BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL
-<U2506> <U007C>
-% BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL
-<U2507> <U007C>
-% BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL
-<U2508> <U002D>
-% BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL
-<U2509> <U003D>
-% BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL
-<U250A> <U007C>
-% BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL
-<U250B> <U007C>
-% BOX DRAWINGS LIGHT DOWN AND RIGHT
-<U250C> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY
-<U250D> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT
-<U250E> <U002B>
-% BOX DRAWINGS HEAVY DOWN AND RIGHT
-<U250F> <U002B>
-% BOX DRAWINGS LIGHT DOWN AND LEFT
-<U2510> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY
-<U2511> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT
-<U2512> <U002B>
-% BOX DRAWINGS HEAVY DOWN AND LEFT
-<U2513> <U002B>
-% BOX DRAWINGS LIGHT UP AND RIGHT
-<U2514> <U002B>
-% BOX DRAWINGS UP LIGHT AND RIGHT HEAVY
-<U2515> <U002B>
-% BOX DRAWINGS UP HEAVY AND RIGHT LIGHT
-<U2516> <U002B>
-% BOX DRAWINGS HEAVY UP AND RIGHT
-<U2517> <U002B>
-% BOX DRAWINGS LIGHT UP AND LEFT
-<U2518> <U002B>
-% BOX DRAWINGS UP LIGHT AND LEFT HEAVY
-<U2519> <U002B>
-% BOX DRAWINGS UP HEAVY AND LEFT LIGHT
-<U251A> <U002B>
-% BOX DRAWINGS HEAVY UP AND LEFT
-<U251B> <U002B>
-% BOX DRAWINGS LIGHT VERTICAL AND RIGHT
-<U251C> <U002B>
-% BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY
-<U251D> <U002B>
-% BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT
-<U251E> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT
-<U251F> <U002B>
-% BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT
-<U2520> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY
-<U2521> <U002B>
-% BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY
-<U2522> <U002B>
-% BOX DRAWINGS HEAVY VERTICAL AND RIGHT
-<U2523> <U002B>
-% BOX DRAWINGS LIGHT VERTICAL AND LEFT
-<U2524> <U002B>
-% BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY
-<U2525> <U002B>
-% BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT
-<U2526> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT
-<U2527> <U002B>
-% BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT
-<U2528> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY
-<U2529> <U002B>
-% BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY
-<U252A> <U002B>
-% BOX DRAWINGS HEAVY VERTICAL AND LEFT
-<U252B> <U002B>
-% BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
-<U252C> <U002B>
-% BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT
-<U252D> <U002B>
-% BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT
-<U252E> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY
-<U252F> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT
-<U2530> <U002B>
-% BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY
-<U2531> <U002B>
-% BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY
-<U2532> <U002B>
-% BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
-<U2533> <U002B>
-% BOX DRAWINGS LIGHT UP AND HORIZONTAL
-<U2534> <U002B>
-% BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT
-<U2535> <U002B>
-% BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT
-<U2536> <U002B>
-% BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY
-<U2537> <U002B>
-% BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT
-<U2538> <U002B>
-% BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY
-<U2539> <U002B>
-% BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY
-<U253A> <U002B>
-% BOX DRAWINGS HEAVY UP AND HORIZONTAL
-<U253B> <U002B>
-% BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
-<U253C> <U002B>
-% BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT
-<U253D> <U002B>
-% BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT
-<U253E> <U002B>
-% BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY
-<U253F> <U002B>
-% BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT
-<U2540> <U002B>
-% BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT
-<U2541> <U002B>
-% BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT
-<U2542> <U002B>
-% BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT
-<U2543> <U002B>
-% BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT
-<U2544> <U002B>
-% BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT
-<U2545> <U002B>
-% BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT
-<U2546> <U002B>
-% BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY
-<U2547> <U002B>
-% BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY
-<U2548> <U002B>
-% BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY
-<U2549> <U002B>
-% BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY
-<U254A> <U002B>
-% BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
-<U254B> <U002B>
-% BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL
-<U254C> <U002D>
-% BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL
-<U254D> <U003D>
-% BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL
-<U254E> <U007C>
-% BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL
-<U254F> <U007C>
-% BOX DRAWINGS DOUBLE HORIZONTAL
-<U2550> <U003D>
-% BOX DRAWINGS DOUBLE VERTICAL
-<U2551> <U007C>
-% BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
-<U2552> <U002B>
-% BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
-<U2553> <U002B>
-% BOX DRAWINGS DOUBLE DOWN AND RIGHT
-<U2554> <U002B>
-% BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
-<U2555> <U002B>
-% BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
-<U2556> <U002B>
-% BOX DRAWINGS DOUBLE DOWN AND LEFT
-<U2557> <U002B>
-% BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
-<U2558> <U002B>
-% BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
-<U2559> <U002B>
-% BOX DRAWINGS DOUBLE UP AND RIGHT
-<U255A> <U002B>
-% BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
-<U255B> <U002B>
-% BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
-<U255C> <U002B>
-% BOX DRAWINGS DOUBLE UP AND LEFT
-<U255D> <U002B>
-% BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
-<U255E> <U002B>
-% BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
-<U255F> <U002B>
-% BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
-<U2560> <U002B>
-% BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
-<U2561> <U002B>
-% BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
-<U2562> <U002B>
-% BOX DRAWINGS DOUBLE VERTICAL AND LEFT
-<U2563> <U002B>
-% BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
-<U2564> <U002B>
-% BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
-<U2565> <U002B>
-% BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
-<U2566> <U002B>
-% BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
-<U2567> <U002B>
-% BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
-<U2568> <U002B>
-% BOX DRAWINGS DOUBLE UP AND HORIZONTAL
-<U2569> <U002B>
-% BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
-<U256A> <U002B>
-% BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
-<U256B> <U002B>
-% BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
-<U256C> <U002B>
-% BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
-<U256D> <U002B>
-% BOX DRAWINGS LIGHT ARC DOWN AND LEFT
-<U256E> <U002B>
-% BOX DRAWINGS LIGHT ARC UP AND LEFT
-<U256F> <U002B>
-% BOX DRAWINGS LIGHT ARC UP AND RIGHT
-<U2570> <U002B>
-% BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT
-<U2571> <U002F>
-% BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT
-<U2572> <U005C>
-% BOX DRAWINGS LIGHT DIAGONAL CROSS
-<U2573> <U0058>
-% BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT
-<U257C> <U002D>
-% BOX DRAWINGS LIGHT UP AND HEAVY DOWN
-<U257D> <U007C>
-% BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT
-<U257E> <U002D>
-% BOX DRAWINGS HEAVY UP AND LIGHT DOWN
-<U257F> <U007C>
-% WHITE CIRCLE
-<U25CB> <U006F>
-% WHITE BULLET
-<U25E6> <U006F>
-% BLACK STAR
-<U2605> <U002A>
-% WHITE STAR
-<U2606> <U002A>
-% BALLOT BOX WITH X
-<U2612> <U0058>
-% SALTIRE
-<U2613> <U0058>
-% WHITE FROWNING FACE
-<U2639> "<U003A><U002D><U0028>"
-% WHITE SMILING FACE
-<U263A> "<U003A><U002D><U0029>"
-% BLACK SMILING FACE
-<U263B> "<U0028><U002D><U003A>"
-% MUSIC FLAT SIGN
-<U266D> <U0062>
-% MUSIC SHARP SIGN
-<U266F> <U0023>
-% UPPER BLADE SCISSORS
-<U2701> "<U0025><U003C>"
-% BLACK SCISSORS
-<U2702> "<U0025><U003C>"
-% LOWER BLADE SCISSORS
-<U2703> "<U0025><U003C>"
-% WHITE SCISSORS
-<U2704> "<U0025><U003C>"
-% VICTORY HAND
-<U270C> <U0056>
-% CHECK MARK
-<U2713> <U221A>
-% HEAVY CHECK MARK
-<U2714> <U221A>
-% MULTIPLICATION X
-<U2715> <U0078>
-% HEAVY MULTIPLICATION X
-<U2716> <U0078>
-% BALLOT X
-<U2717> <U0058>
-% HEAVY BALLOT X
-<U2718> <U0058>
-% OUTLINED GREEK CROSS
-<U2719> <U002B>
-% HEAVY GREEK CROSS
-<U271A> <U002B>
-% OPEN CENTRE CROSS
-<U271B> <U002B>
-% HEAVY OPEN CENTRE CROSS
-<U271C> <U002B>
-% LATIN CROSS
-<U271D> <U002B>
-% SHADOWED WHITE LATIN CROSS
-<U271E> <U002B>
-% OUTLINED LATIN CROSS
-<U271F> <U002B>
-% MALTESE CROSS
-<U2720> <U002B>
-% STAR OF DAVID
-<U2721> <U002A>
-% FOUR TEARDROP-SPOKED ASTERISK
-<U2722> <U002B>
-% FOUR BALLOON-SPOKED ASTERISK
-<U2723> <U002B>
-% HEAVY FOUR BALLOON-SPOKED ASTERISK
-<U2724> <U002B>
-% FOUR CLUB-SPOKED ASTERISK
-<U2725> <U002B>
-% BLACK FOUR POINTED STAR
-<U2726> <U002B>
-% WHITE FOUR POINTED STAR
-<U2727> <U002B>
-% STRESS OUTLINED WHITE STAR
-<U2729> <U002A>
-% CIRCLED WHITE STAR
-<U272A> <U002A>
-% OPEN CENTRE BLACK STAR
-<U272B> <U002A>
-% BLACK CENTRE WHITE STAR
-<U272C> <U002A>
-% OUTLINED BLACK STAR
-<U272D> <U002A>
-% HEAVY OUTLINED BLACK STAR
-<U272E> <U002A>
-% PINWHEEL STAR
-<U272F> <U002A>
-% SHADOWED WHITE STAR
-<U2730> <U002A>
-% HEAVY ASTERISK
-<U2731> <U002A>
-% OPEN CENTRE ASTERISK
-<U2732> <U002A>
-% EIGHT SPOKED ASTERISK
-<U2733> <U002A>
-% EIGHT POINTED BLACK STAR
-<U2734> <U002A>
-% EIGHT POINTED PINWHEEL STAR
-<U2735> <U002A>
-% SIX POINTED BLACK STAR
-<U2736> <U002A>
-% EIGHT POINTED RECTILINEAR BLACK STAR
-<U2737> <U002A>
-% HEAVY EIGHT POINTED RECTILINEAR BLACK STAR
-<U2738> <U002A>
-% TWELVE POINTED BLACK STAR
-<U2739> <U002A>
-% SIXTEEN POINTED ASTERISK
-<U273A> <U002A>
-% TEARDROP-SPOKED ASTERISK
-<U273B> <U002A>
-% OPEN CENTRE TEARDROP-SPOKED ASTERISK
-<U273C> <U002A>
-% HEAVY TEARDROP-SPOKED ASTERISK
-<U273D> <U002A>
-% SIX PETALLED BLACK AND WHITE FLORETTE
-<U273E> <U002A>
-% BLACK FLORETTE
-<U273F> <U002A>
-% WHITE FLORETTE
-<U2740> <U002A>
-% EIGHT PETALLED OUTLINED BLACK FLORETTE
-<U2741> <U002A>
-% CIRCLED OPEN CENTRE EIGHT POINTED STAR
-<U2742> <U002A>
-% HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK
-<U2743> <U002A>
-% SNOWFLAKE
-<U2744> <U002A>
-% TIGHT TRIFOLIATE SNOWFLAKE
-<U2745> <U002A>
-% HEAVY CHEVRON SNOWFLAKE
-<U2746> <U002A>
-% SPARKLE
-<U2747> <U002A>
-% HEAVY SPARKLE
-<U2748> <U002A>
-% BALLOON-SPOKED ASTERISK
-<U2749> <U002A>
-% EIGHT TEARDROP-SPOKED PROPELLER ASTERISK
-<U274A> <U002A>
-% HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK
-<U274B> <U002A>
-% LATIN SMALL LIGATURE FF
-<UFB00> "<U0066><U0066>"
-% LATIN SMALL LIGATURE FI
-<UFB01> <U009E>;"<U0066><U0069>"
-% LATIN SMALL LIGATURE FL
-<UFB02> <U009F>;"<U0066><U006C>"
-% LATIN SMALL LIGATURE FFI
-<UFB03> "<U0066><U0066><U0069>"
-% LATIN SMALL LIGATURE FFL
-<UFB04> "<U0066><U0066><U006C>"
-% LATIN SMALL LIGATURE LONG S T
-<UFB05>
"<U017F><U0074>";"<U0073><U0074>"
-% LATIN SMALL LIGATURE ST
-<UFB06> "<U0073><U0074>"
-% ZERO WIDTH NO-BREAK SPACE
-<UFEFF> ""
-% REPLACEMENT CHARACTER
-<UFFFD> <U003F>
diff --git a/utils/tt2code b/utils/tt2code
deleted file mode 100755
index 170954d..0000000
--- a/utils/tt2code
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/perl -W
-
-print <<END;
-/*
- * This file is part of NetSurf,
http://netsurf-browser.org/
- * Licensed under the GNU General Public License,
- *
http://www.opensource.org/licenses/gpl-license
- * Copyright 2003 James Bursa <bursa\(a)users.sourceforge.net>
- */
-
-#include "utils/utils.h"
-
-void unicode_transliterate(unsigned int c, char **r)
-{
- char *s = *r;
- switch (c) {
-
-END
-
-LINE: while (<>) {
- chomp;
- next if m/^%/;
- next if m/^ *$/;
-
- m/^<U([0-9A-F]{4})> /g or die "invalid line '$_'";
- $z = $1;
- next if (hex($z) < 256);
-
- SUBST: while (m/\G"?((<U([0-9A-F]{4})>)*)"?;?/g) {
- next if $& eq '';
- $m = $1;
- if ($m eq '') {
- print "case 0x$z: break;\n";
- next;
- }
- chop $m;
- @s = split /></, substr $m, 1;
- foreach $s (@s) {
- $s = substr $s, 1;
- next SUBST if 255 < hex($s);
- }
-
- print "case 0x$z: ";
- foreach $s (@s) {
- print "*s++ = 0x$s; ";
- }
- print "break;\n";
- next LINE;
- }
-}
-
-print <<END;
-
-default: *s++ = '?'; break;
- }
-
- *r = s;
-}
-END
-
diff --git a/utils/useragent.c b/utils/useragent.c
index 5b8c9e1..91f4363 100644
--- a/utils/useragent.c
+++ b/utils/useragent.c
@@ -29,7 +29,7 @@
static const char *core_user_agent_string = NULL;
#ifndef NETSURF_UA_FORMAT_STRING
-#define NETSURF_UA_FORMAT_STRING "NetSurf/%d.%d (%s; %s)"
+#define NETSURF_UA_FORMAT_STRING "NetSurf/%d.%d (%s)"
#endif
/**
@@ -41,20 +41,17 @@ user_agent_build_string(void)
{
struct utsname un;
const char *sysname = "Unknown";
- const char *machine = "Unknown";
char *ua_string;
int len;
if (uname(&un) >= 0) {
sysname = un.sysname;
- machine = un.machine;
}
len = snprintf(NULL, 0, NETSURF_UA_FORMAT_STRING,
netsurf_version_major,
netsurf_version_minor,
- sysname,
- machine);
+ sysname);
ua_string = malloc(len + 1);
if (!ua_string) {
/** \todo this needs handling better */
@@ -64,8 +61,7 @@ user_agent_build_string(void)
NETSURF_UA_FORMAT_STRING,
netsurf_version_major,
netsurf_version_minor,
- sysname,
- machine);
+ sysname);
core_user_agent_string = ua_string;
diff --git a/utils/utils.h b/utils/utils.h
index f3dba44..8172d2d 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -153,7 +153,6 @@ char *remove_underscores(const char *s, bool replacespace);
char *cnv_space2nbsp(const char *s);
bool is_dir(const char *path);
void regcomp_wrapper(regex_t *preg, const char *regex, int cflags);
-void unicode_transliterate(unsigned int c, char **r);
char *human_friendly_bytesize(unsigned long bytesize);
const char *rfc1123_date(time_t t);
unsigned int wallclock(void);
--
NetSurf Browser