# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1042847564 0 # Node ID efd4703450fa7fa98116a39b1ce83435e1a5c5c4 # Parent d946e329670c2b293552b4ae355621f6a4a67dc8 Build test application on Unix too... and also fixed GTK to allow OS/2 style colors in dw_color_xxx_set(). diff -r d946e329670c -r efd4703450fa Makefile.in --- a/Makefile.in Fri Jan 17 23:28:28 2003 +0000 +++ b/Makefile.in Fri Jan 17 23:52:44 2003 +0000 @@ -99,3 +99,6 @@ $(SYSCONF_LINK_TARGET): $(OBJECTS) $(SYSCONF_LINK_LIB) + +dwtest: dwtest.o + $(CC) -o dwtest dwtest.o -Llib -ldw -ldwcompat $(LFLAGS) diff -r d946e329670c -r efd4703450fa dwtest.c --- a/dwtest.c Fri Jan 17 23:28:28 2003 +0000 +++ b/dwtest.c Fri Jan 17 23:52:44 2003 +0000 @@ -61,7 +61,7 @@ browsebox = dw_box_new(BOXHORZ, 0); - dw_box_pack_start(lbbox, browsebox, 130, 15, TRUE, TRUE, 0); + dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); entryfield = dw_entryfield_new("", 100L); @@ -110,7 +110,7 @@ /* Buttons */ buttonbox = dw_box_new(BOXHORZ, 10); - dw_box_pack_start(lbbox, buttonbox, 140, 210, TRUE, TRUE, 0); + dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); okbutton = dw_button_new("Ok", 1001L); @@ -149,7 +149,7 @@ void text_add(void) { - int i,x,y; + int i,y,depth = dw_color_depth(); char buf[10]; HPIXMAP text1pm,text2pm; @@ -157,15 +157,15 @@ dw_box_pack_start( notebookbox2, pagebox, 1, 1, TRUE, TRUE, 0); textbox1 = dw_render_new( 100 ); - dw_box_pack_start( pagebox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 4); + dw_box_pack_start( pagebox, textbox1, font_width*width1, font_height*rows, TRUE, TRUE, 4); dw_window_set_font(textbox1, "9.WarpSans"); textbox2 = dw_render_new( 101 ); dw_box_pack_start( pagebox, textbox2, font_width*width2, font_height*rows, TRUE, TRUE, 4); dw_window_set_font(textbox2, "9.WarpSans"); - text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, 32 ); - text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, 32 ); + text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth ); + text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, depth ); dw_color_foreground_set(DW_CLR_WHITE); dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); @@ -210,14 +210,14 @@ notebookbox1 = dw_box_new( BOXVERT, 5 ); notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); - fprintf( stderr, "page1: %d\n", notebookpage1 ); + fprintf( stderr, "page1: %ld\n", notebookpage1 ); dw_notebook_page_set_text( notebook, notebookpage1, "first page"); archive_add(); notebookbox2 = dw_box_new( BOXVERT, 5 ); notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); - fprintf( stderr, "page2: %d\n",notebookpage2); + fprintf( stderr, "page2: %ld\n",notebookpage2); dw_notebook_page_set_text( notebook, notebookpage2, "second page"); text_add(); diff -r d946e329670c -r efd4703450fa gtk/dw.c --- a/gtk/dw.c Fri Jan 17 23:28:28 2003 +0000 +++ b/gtk/dw.c Fri Jan 17 23:52:44 2003 +0000 @@ -4595,6 +4595,19 @@ return tmp; } +/* Returns a GdkColor from a DW color */ +GdkColor _internal_color(unsigned long value) +{ + if(DW_RGB_COLOR & value) + { + GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + return color; + } + else if (value < 16) + return _colors[value]; + return _colors[0]; +} + /* Sets the current foreground drawing color. * Parameters: * red: red value. @@ -4604,7 +4617,7 @@ void dw_color_foreground_set(unsigned long value) { int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); - GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + GdkColor color = _internal_color(value); DW_MUTEX_LOCK; gdk_color_alloc(_dw_cmap, &color); @@ -4621,7 +4634,7 @@ void dw_color_background_set(unsigned long value) { int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); - GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + GdkColor color = _internal_color(value); DW_MUTEX_LOCK; gdk_color_alloc(_dw_cmap, &color);