void SetTexMods(){ texturewin = Texturewin(); l_pIncrement = Get_SI_Inc(); #ifdef DBG_SI Sys_Printf( "SurfaceDlg SetTexMods\n" ); #endif if ( !g_surfwin ) { return; } g_bListenChanged = FALSE; if ( strncmp( texturewin->texdef.GetName(), "textures/", 9 ) != 0 ) { texdef_SI_values.SetName( SHADER_NOT_FOUND ); } gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hshift_value_spinbutton ), l_pIncrement->shift[0], l_pIncrement->shift[0] ); gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vshift_value_spinbutton ), l_pIncrement->shift[1], l_pIncrement->shift[1] ); gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hscale_value_spinbutton ), l_pIncrement->scale[0], l_pIncrement->scale[0] ); gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vscale_value_spinbutton ), l_pIncrement->scale[1], l_pIncrement->scale[0] ); gtk_spin_button_set_increments( GTK_SPIN_BUTTON( rotate_value_spinbutton ), l_pIncrement->rotate, l_pIncrement->rotate ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate ); g_bListenChanged = TRUE; }
static void frequency_changed (GtkSpinButton *button, gpointer user_data) { CEPageBond *self = user_data; CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self); int frequency, delay; frequency = gtk_spin_button_get_value_as_int (priv->frequency); /* Round updelay and downdelay up to a multiple of frequency */ delay = gtk_spin_button_get_value_as_int (priv->updelay); if (frequency == 0) { if (delay != 0) gtk_spin_button_set_value (priv->updelay, 0.0); } else if (delay % frequency) { delay += frequency - (delay % frequency); gtk_spin_button_set_value (priv->updelay, delay); } gtk_spin_button_set_increments (priv->updelay, frequency, frequency); delay = gtk_spin_button_get_value_as_int (priv->downdelay); if (frequency == 0) { if (delay != 0) gtk_spin_button_set_value (priv->downdelay, 0.0); } else if (delay % frequency) { delay += frequency - (delay % frequency); gtk_spin_button_set_value (priv->downdelay, (gdouble)delay); } gtk_spin_button_set_increments (priv->downdelay, frequency, frequency); }
void pageOne() { /* Set the window title */ gtk_window_set_title (GTK_WINDOW (window), "Start Here"); g_signal_connect (window, "delete-event", G_CALLBACK (delete_event), NULL); /* Creating tables */ MainTable = gtk_table_new (1, 2, TRUE); RightTable = gtk_table_new (16, 5, TRUE); /* Put the table in the main window */ gtk_container_add (GTK_CONTAINER (window), MainTable); gtk_table_attach_defaults (GTK_TABLE (MainTable),RightTable , 1, 2, 0, 1); // Creating the tempo entry/ NameEntry = gtk_entry_new (); gtk_entry_set_text(GTK_ENTRY(NameEntry),"Default"); //TempoEntry = gtk_spin_button_new( NULL, 2, 0); gtk_table_attach_defaults (GTK_TABLE (RightTable),NameEntry, 0, 2, 4, 5); //* Creating the Tempo entry adjustment = gtk_adjustment_new (150.0, 100.0, 300.0, 1.0, 5.0, 0.0); TempoEntry = gtk_spin_button_new( adjustment, 2.0, 0); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(TempoEntry), 1, 5); gtk_table_attach_defaults (GTK_TABLE (RightTable),TempoEntry, 0, 2, 6, 7); }
void wxSpinCtrlGTKBase::DoSetIncrement(double inc) { wxCHECK_RET( m_widget, "invalid spin button" ); GtkDisableEvents(); gtk_spin_button_set_increments( GTK_SPIN_BUTTON(m_widget), inc, 10*inc); GtkEnableEvents(); }
GtkWidget * AP_UnixDialog_InsertTable::_constructWindow(void) { GtkWidget * window; const XAP_StringSet * pSS = m_pApp->getStringSet(); #if GTK_CHECK_VERSION(3,0,0) GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable.ui"); #else GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_InsertTable")); GtkWidget * widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")); UT_ASSERT(widget); // it shouldn't happen if things are propoerly installed. m_radioGroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); m_pColSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumCols")); m_pRowSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumRows")); m_pColWidthSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbColSize")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColSpin), getNumCols()); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pRowSpin), getNumRows()); GtkWidget *rbAutoColSize = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")); UT_ASSERT(rbAutoColSize); s_auto_colsize_toggled (GTK_TOGGLE_BUTTON (rbAutoColSize), m_pColWidthSpin); g_signal_connect (G_OBJECT (rbAutoColSize), "toggled", G_CALLBACK (s_auto_colsize_toggled), m_pColWidthSpin); // set the dialog title std::string s; pSS->getValueUTF8(AP_STRING_ID_DLG_InsertTable_TableTitle,s); abiDialogSetTitle(window, "%s", s.c_str()); // Units gtk_label_set_text (GTK_LABEL (GTK_WIDGET(gtk_builder_get_object(builder, "lbInch"))), UT_dimensionName(m_dim)); double spinstep = getSpinIncr (); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(m_pColWidthSpin), spinstep, spinstep * 5); double spinmin = getSpinMin (); gtk_spin_button_set_range (GTK_SPIN_BUTTON(m_pColWidthSpin), spinmin, spinmin * 1000); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColWidthSpin), m_columnWidth); // localize the strings in our dialog, and set tags for some widgets localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTableSize")), pSS, AP_STRING_ID_DLG_InsertTable_TableSize); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumCols")), pSS, AP_STRING_ID_DLG_InsertTable_NumCols); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumRows")), pSS, AP_STRING_ID_DLG_InsertTable_NumRows); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbAutoFit")), pSS, AP_STRING_ID_DLG_InsertTable_AutoFit); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")), pSS, AP_STRING_ID_DLG_InsertTable_AutoColSize); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_AUTOSIZE)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize")), pSS, AP_STRING_ID_DLG_InsertTable_FixedColSize); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_FIXEDSIZE)); localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btInsert")), pSS, AP_STRING_ID_DLG_InsertButton); g_object_unref(G_OBJECT(builder)); return window; }
static void facq_plug_dialog_constructed(GObject *self) { FacqPlugDialog *dialog = FACQ_PLUG_DIALOG(self); GtkWidget *vbox = NULL, *table = NULL, *widget = NULL; dialog->priv->dialog = gtk_dialog_new_with_buttons("Plug preferences", GTK_WINDOW(dialog->priv->top_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL, GTK_STOCK_OK,GTK_RESPONSE_OK,NULL); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog->priv->dialog)); table = gtk_table_new(2,2,FALSE); widget = gtk_label_new("Address:"); gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT); gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,0,1); widget = gtk_entry_new(); if(dialog->priv->address) gtk_entry_set_text(GTK_ENTRY(widget),dialog->priv->address); else gtk_entry_set_text(GTK_ENTRY(widget),"all"); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,GTK_STOCK_NETWORK); gtk_entry_set_icon_activatable(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,TRUE); gtk_entry_set_icon_activatable(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,TRUE); gtk_entry_set_icon_sensitive(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,TRUE); gtk_entry_set_icon_sensitive(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,TRUE); g_signal_connect(widget,"icon-press", G_CALLBACK(address_icons_callback),dialog); dialog->priv->address_entry = widget; gtk_table_attach_defaults(GTK_TABLE(table),widget,1,2,0,1); widget = gtk_label_new("Port:"); gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT); gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,1,2); widget = gtk_spin_button_new_with_range(0,65535,1); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,GTK_STOCK_CONNECT); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(widget),1,10); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(widget),0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),dialog->priv->port); g_signal_connect(GTK_ENTRY(widget),"icon-press", G_CALLBACK(port_icons_callback),dialog); dialog->priv->spin_button = widget; gtk_table_attach_defaults(GTK_TABLE(table),widget,1,2,1,2); gtk_widget_show_all(table); gtk_container_add(GTK_CONTAINER(vbox),table); }
void wxSpinCtrlGTKBase::DoSetIncrement(double inc) { wxCHECK_RET( m_widget, "invalid spin button" ); wxSpinCtrlEventDisabler disable(this); // Preserve the old page value when changing just the increment. double page = 10*inc; gtk_spin_button_get_increments( GTK_SPIN_BUTTON(m_widget), NULL, &page); gtk_spin_button_set_increments( GTK_SPIN_BUTTON(m_widget), inc, page); }
void jam_spin_button_set(GtkSpinButton *w, gboolean numeric, gdouble min, gdouble max, gdouble step, gdouble page, gint digits) { g_assert(GTK_IS_SPIN_BUTTON(w)); gtk_spin_button_set_numeric(w, numeric); gtk_spin_button_set_range(w, min, max); gtk_spin_button_set_increments(w, step, page); gtk_spin_button_set_digits(w, digits); }
void trace_view_store_set_spin_button(TraceViewStore *store, GtkWidget *spin) { g_return_if_fail (TRACE_VIEW_IS_LIST (store)); g_return_if_fail (GTK_IS_SPIN_BUTTON (spin)); if (store->spin) g_object_unref(store->spin); store->spin = spin; g_object_ref(spin); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(store->spin), 1.0, 5.0); update_page(store); }
int clip_GTK_SPINBUTTONSETINCREMENTS(ClipMachine * ClipMachineMemory) { C_widget *cspb = _fetch_cw_arg(ClipMachineMemory); gdouble step = _clip_parnd(ClipMachineMemory, 2); gdouble page = _clip_parnd(ClipMachineMemory, 3); CHECKCWID(cspb, GTK_IS_SPIN_BUTTON); CHECKARG(2, NUMERIC_type_of_ClipVarType); CHECKARG(3, NUMERIC_type_of_ClipVarType); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(cspb->widget), step, page); return 0; err: return 1; }
static void change_unit (GtkSpinButton *spinbutton, gdouble factor, gint digits, gdouble step, gdouble page) { gdouble value; gdouble range; gtk_spin_button_get_range (spinbutton, NULL, &range); range *= factor; value = gtk_spin_button_get_value (spinbutton); value *= factor; gtk_spin_button_set_range (spinbutton, 0, range); gtk_spin_button_set_value (spinbutton, value); gtk_spin_button_set_digits (spinbutton, digits); gtk_spin_button_set_increments (spinbutton, step, page); }
static void facq_baf_view_dialog_constructed(GObject *self) { FacqBAFViewDialog *dialog = FACQ_BAF_VIEW_DIALOG(self); GtkWidget *vbox = NULL, *table = NULL, *widget = NULL; dialog->priv->dialog = gtk_dialog_new_with_buttons(_("Page preferences"), GTK_WINDOW(dialog->priv->top_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL, GTK_STOCK_OK,GTK_RESPONSE_OK,NULL); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog->priv->dialog)); table = gtk_table_new(1,3,FALSE); widget = gtk_label_new(_("Time per page:")); gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT); gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,0,1); widget = gtk_spin_button_new_with_range(5,86400,1); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(widget),1,10); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(widget),0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),10); g_signal_connect(GTK_ENTRY(widget),"icon-press", G_CALLBACK(clear_icon_callback),dialog); dialog->priv->spin_button = widget; gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,1,2); widget = gtk_label_new(_(" seconds")); gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT); gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,2,3); gtk_widget_show_all(table); gtk_container_add(GTK_CONTAINER(vbox),table); }
static GtkWidget * vnr_crop_build_dialog (VnrCrop *crop) { GtkBuilder *builder; GtkWidget *window; GdkPixbuf *original; GdkPixbuf *preview; GError *error = NULL; builder = gtk_builder_new (); gtk_builder_add_from_file (builder, CROP_UI_PATH, &error); if (error != NULL) { g_warning ("%s\n", error->message); g_object_unref(builder); return NULL; } window = GTK_WIDGET (gtk_builder_get_object (builder, "crop-dialog")); gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(crop->vnr_win)); original = uni_image_view_get_pixbuf(UNI_IMAGE_VIEW(crop->vnr_win->view)); gdouble width, height; width = crop->vnr_win->current_image_width; height = crop->vnr_win->current_image_height; vnr_tools_fit_to_size_double(&height, &width, 400,400); crop->width = width; crop->height = height; crop->zoom = ( width/crop->vnr_win->current_image_width + height/crop->vnr_win->current_image_height )/2; preview = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (original), gdk_pixbuf_get_has_alpha (original), gdk_pixbuf_get_bits_per_sample (original), width, height); uni_pixbuf_scale_blend(original, preview, 0, 0, width, height, 0, 0, crop->zoom, GDK_INTERP_BILINEAR, 0, 0); crop->preview_pixbuf = preview; crop->image = GTK_WIDGET (gtk_builder_get_object (builder, "main-image")); gtk_widget_set_size_request(crop->image, width, height); crop->spin_x = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "spin-x")); gtk_spin_button_set_range (crop->spin_x, 0, crop->vnr_win->current_image_width - 1); gtk_spin_button_set_increments (crop->spin_x, 1, 10); crop->spin_y = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "spin-y")); gtk_spin_button_set_range (crop->spin_y, 0, crop->vnr_win->current_image_height - 1); gtk_spin_button_set_increments (crop->spin_y, 1, 10); crop->spin_width = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "spin-width")); gtk_spin_button_set_range (crop->spin_width, 1, crop->vnr_win->current_image_width); gtk_spin_button_set_increments (crop->spin_width, 1, 10); gtk_spin_button_set_value (crop->spin_width, crop->vnr_win->current_image_width); crop->spin_height = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "spin-height")); gtk_spin_button_set_range (crop->spin_height, 1, crop->vnr_win->current_image_height); gtk_spin_button_set_increments (crop->spin_height, 1, 10); gtk_spin_button_set_value (crop->spin_height, crop->vnr_win->current_image_height); gtk_widget_set_events (crop->image, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_MOTION_MASK); g_signal_connect (crop->image, "expose-event", G_CALLBACK (drawable_expose_cb), crop); g_signal_connect (crop->image, "button-press-event", G_CALLBACK (drawable_button_press_cb), crop); g_signal_connect (crop->image, "button-release-event", G_CALLBACK (drawable_button_release_cb), crop); g_signal_connect (crop->image, "motion-notify-event", G_CALLBACK (drawable_motion_cb), crop); g_signal_connect (crop->spin_width, "value-changed", G_CALLBACK (spin_width_cb), crop); g_signal_connect (crop->spin_x, "value-changed", G_CALLBACK (spin_x_cb), crop); g_signal_connect (crop->spin_height, "value-changed", G_CALLBACK (spin_height_cb), crop); g_signal_connect (crop->spin_y, "value-changed", G_CALLBACK (spin_y_cb), crop); g_object_unref(builder); return window; }
/** \brief Create and initialise widgets for the refresh rates tab. * * The widgets must be preloaded with values from config. If a config value * is NULL, sensible default values, eg. those from defaults.h should * be laoded. */ GtkWidget *sat_pref_refresh_create (GKeyFile *cfg) { GtkWidget *table; GtkWidget *vbox; GtkWidget *label; gint val; dirty = FALSE; reset = FALSE; /* create table */ table = gtk_table_new (6, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 10); gtk_table_set_col_spacings (GTK_TABLE (table), 5); /* data refresh */ label = gtk_label_new (_("Refresh data every")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); dataspin = gtk_spin_button_new_with_range (100, 10000, 1); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (dataspin), 1, 100); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dataspin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (dataspin), GTK_UPDATE_IF_VALID); if (cfg != NULL) { val = mod_cfg_get_int (cfg, MOD_CFG_GLOBAL_SECTION, MOD_CFG_TIMEOUT_KEY, SAT_CFG_INT_MODULE_TIMEOUT); } else { val = sat_cfg_get_int (SAT_CFG_INT_MODULE_TIMEOUT); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (dataspin), val); g_signal_connect (G_OBJECT (dataspin), "value-changed", G_CALLBACK (spin_changed_cb), NULL); gtk_table_attach (GTK_TABLE (table), dataspin, 1, 2, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); label = gtk_label_new (_("[msec]")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* separator */ gtk_table_attach (GTK_TABLE (table), gtk_hseparator_new (), 0, 3, 1, 2, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* List View */ label = gtk_label_new (_("Refresh list view every")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0); listspin = gtk_spin_button_new_with_range (1, 50, 1); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (listspin), 1, 5); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (listspin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (listspin), GTK_UPDATE_IF_VALID); if (cfg != NULL) { val = mod_cfg_get_int (cfg, MOD_CFG_LIST_SECTION, MOD_CFG_LIST_REFRESH, SAT_CFG_INT_LIST_REFRESH); } else { val = sat_cfg_get_int (SAT_CFG_INT_LIST_REFRESH); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (listspin), val); g_signal_connect (G_OBJECT (listspin), "value-changed", G_CALLBACK (spin_changed_cb), NULL); gtk_table_attach (GTK_TABLE (table), listspin, 1, 2, 2, 3, GTK_FILL, GTK_SHRINK, 0, 0); label = gtk_label_new (_("[cycle]")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* Map View */ label = gtk_label_new (_("Refresh map view every")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL, GTK_SHRINK, 0, 0); mapspin = gtk_spin_button_new_with_range (1, 50, 1); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (mapspin), 1, 5); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (mapspin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (mapspin), GTK_UPDATE_IF_VALID); if (cfg != NULL) { val = mod_cfg_get_int (cfg, MOD_CFG_MAP_SECTION, MOD_CFG_MAP_REFRESH, SAT_CFG_INT_MAP_REFRESH); } else { val = sat_cfg_get_int (SAT_CFG_INT_MAP_REFRESH); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (mapspin), val); g_signal_connect (G_OBJECT (mapspin), "value-changed", G_CALLBACK (spin_changed_cb), NULL); gtk_table_attach (GTK_TABLE (table), mapspin, 1, 2, 3, 4, GTK_FILL, GTK_SHRINK, 0, 0); label = gtk_label_new (_("[cycle]")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* Polar View */ label = gtk_label_new (_("Refresh polar view every")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL, GTK_SHRINK, 0, 0); polarspin = gtk_spin_button_new_with_range (1, 50, 1); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (polarspin), 1, 5); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (polarspin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (polarspin), GTK_UPDATE_IF_VALID); if (cfg != NULL) { val = mod_cfg_get_int (cfg, MOD_CFG_POLAR_SECTION, MOD_CFG_POLAR_REFRESH, SAT_CFG_INT_POLAR_REFRESH); } else { val = sat_cfg_get_int (SAT_CFG_INT_POLAR_REFRESH); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (polarspin), val); g_signal_connect (G_OBJECT (polarspin), "value-changed", G_CALLBACK (spin_changed_cb), NULL); gtk_table_attach (GTK_TABLE (table), polarspin, 1, 2, 4, 5, GTK_FILL, GTK_SHRINK, 0, 0); label = gtk_label_new (_("[cycle]")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* Single-Sat View */ label = gtk_label_new (_("Refresh single-sat view every")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, GTK_FILL, GTK_SHRINK, 0, 0); singlespin = gtk_spin_button_new_with_range (1, 50, 1); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (singlespin), 1, 5); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (singlespin), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (singlespin), GTK_UPDATE_IF_VALID); if (cfg != NULL) { val = mod_cfg_get_int (cfg, MOD_CFG_SINGLE_SAT_SECTION, MOD_CFG_SINGLE_SAT_REFRESH, SAT_CFG_INT_SINGLE_SAT_REFRESH); } else { val = sat_cfg_get_int (SAT_CFG_INT_SINGLE_SAT_REFRESH); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (singlespin), val); g_signal_connect (G_OBJECT (singlespin), "value-changed", G_CALLBACK (spin_changed_cb), NULL); gtk_table_attach (GTK_TABLE (table), singlespin, 1, 2, 5, 6, GTK_FILL, GTK_SHRINK, 0, 0); label = gtk_label_new (_("[cycle]")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 5, 6, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); /* create vertical box */ vbox = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 20); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); /* create RESET button */ create_reset_button (cfg, GTK_BOX (vbox)); return vbox; }
void menu_request_settings(void) { gint result; GtkDialog * dialog; GtkToggleButton * autostart_studio_button; GtkToggleButton * send_notifications_button; GtkEntry * shell_entry; GtkEntry * terminal_entry; GtkSpinButton * js_delay_spin; GtkEntry * jack_conf_tool_entry; bool autostart; bool notify; const char * shell; const char * terminal; unsigned int js_delay; const char * jack_conf_tool; autostart_studio_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_studio_autostart_checkbutton")); send_notifications_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_send_notifications_checkbutton")); shell_entry = GTK_ENTRY(get_gtk_builder_widget("settings_shell_entry")); terminal_entry = GTK_ENTRY(get_gtk_builder_widget("settings_terminal_entry")); js_delay_spin = GTK_SPIN_BUTTON(get_gtk_builder_widget("settings_js_delay_spin")); jack_conf_tool_entry = GTK_ENTRY(get_gtk_builder_widget("settings_jack_conf_tool_entry")); dialog = GTK_DIALOG(get_gtk_builder_widget("settings_dialog")); if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, &autostart)) { autostart = LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART_DEFAULT; } if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, ¬ify)) { notify = LADISH_CONF_KEY_DAEMON_NOTIFY_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_SHELL, &shell)) { shell = LADISH_CONF_KEY_DAEMON_SHELL_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_TERMINAL, &terminal)) { terminal = LADISH_CONF_KEY_DAEMON_TERMINAL_DEFAULT; } if (!conf_get_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, &js_delay)) { js_delay = LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_JACK_CONF_TOOL, &jack_conf_tool)) { jack_conf_tool = LADISH_CONF_KEY_JACK_CONF_TOOL_DEFAULT; } gtk_toggle_button_set_active(autostart_studio_button, autostart); gtk_toggle_button_set_active(send_notifications_button, notify); gtk_entry_set_text(shell_entry, shell); gtk_entry_set_text(terminal_entry, terminal); gtk_entry_set_text(jack_conf_tool_entry, jack_conf_tool); gtk_spin_button_set_range(js_delay_spin, 0, 1000); gtk_spin_button_set_increments(js_delay_spin, 1, 2); gtk_spin_button_set_value(js_delay_spin, js_delay); gtk_widget_show(GTK_WIDGET(dialog)); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(GTK_WIDGET(dialog)); if (result != GTK_RESPONSE_OK) { return; } autostart = gtk_toggle_button_get_active(autostart_studio_button); notify = gtk_toggle_button_get_active(send_notifications_button); shell = gtk_entry_get_text(shell_entry); terminal = gtk_entry_get_text(terminal_entry); js_delay = gtk_spin_button_get_value(js_delay_spin); jack_conf_tool = gtk_entry_get_text(jack_conf_tool_entry); if (!conf_set_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, autostart) || !conf_set_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, notify) || !conf_set(LADISH_CONF_KEY_DAEMON_SHELL, shell) || !conf_set(LADISH_CONF_KEY_DAEMON_TERMINAL, terminal) || !conf_set_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, js_delay) || !conf_set(LADISH_CONF_KEY_JACK_CONF_TOOL, jack_conf_tool)) { error_message_box(_("Storing settings")); } }
static VALUE rg_set_increments(VALUE self, VALUE step, VALUE page) { gtk_spin_button_set_increments(_SELF(self), NUM2DBL(step), NUM2DBL(page)); return self; }
int main (int argc, char *argv[]) { GtkBuilder *builder; GObject *window; GObject *button; GObject *checkbutton; GObject *spin; GObject *label; gtk_init( &argc, &argv); /* Construct a GtkBuilder instance and load our UI description */ builder = gtk_builder_new(); gtk_builder_add_from_file( builder, "builder.ui", NULL); /* Connect signal handlers to the constructed widgets. */ window = gtk_builder_get_object (builder, "window"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); button = gtk_builder_get_object (builder, "quit"); g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL); /* checkButton for torso */ checkbutton = gtk_builder_get_object(builder,"torso"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( torso)); /* * HERE STARTS THE LEFT SIDE OF THE BODY */ /* checkbutton for left hand */ checkbutton = gtk_builder_get_object(builder,"hand"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( hand)); /* checkbutton for left lowerarm_w_hand */ checkbutton = gtk_builder_get_object(builder,"lowerarm_w_hand"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerarm_w_hand)); /* checkbutton for left lowerarm_wo_hand */ checkbutton = gtk_builder_get_object(builder,"lowerarm_wo_hand"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerarm_wo_hand)); /* checkbutton for left upperarm */ checkbutton = gtk_builder_get_object(builder,"upperarm"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( upperarm)); /* checkbutton for left arm */ checkbutton = gtk_builder_get_object(builder,"arm"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( arm)); /* checkbutton for left foot */ checkbutton = gtk_builder_get_object(builder,"foot"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( foot)); /* checkbutton for left lowerleg_w_foot */ checkbutton = gtk_builder_get_object(builder,"lowerleg_w_foot"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerleg_w_foot)); /* checkbutton for left lowerleg_wo_foot */ checkbutton = gtk_builder_get_object(builder,"lowerleg_wo_foot"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerleg_wo_foot)); /* checkbutton for left upperleg */ checkbutton = gtk_builder_get_object(builder,"upperleg"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( upperleg)); /* checkbutton for left leg */ checkbutton = gtk_builder_get_object(builder,"leg"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( leg)); /* * AND ENDS HERE... RIGHT SIDE STARTS HERE */ /* checkbutton for right hand */ checkbutton = gtk_builder_get_object(builder,"hand_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( hand)); /* checkbutton for right lowerarm_w_hand */ checkbutton = gtk_builder_get_object(builder,"lowerarm_w_hand_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerarm_w_hand)); /* checkbutton for right lowerarm_wo_hand */ checkbutton = gtk_builder_get_object(builder,"lowerarm_wo_hand_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerarm_wo_hand)); /* checkbutton for right upperarm */ checkbutton = gtk_builder_get_object(builder,"upperarm_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( upperarm)); /* checkbutton for right arm */ checkbutton = gtk_builder_get_object(builder,"arm_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( arm)); /* checkbutton for right foot */ checkbutton = gtk_builder_get_object(builder,"foot_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( foot)); /* checkbutton for right lowerleg_w_foot */ checkbutton = gtk_builder_get_object(builder,"lowerleg_w_foot_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerleg_w_foot)); /* checkbutton for right lowerleg_wo_foot */ checkbutton = gtk_builder_get_object(builder,"lowerleg_wo_foot_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( lowerleg_wo_foot)); /* checkbutton for right upperleg */ checkbutton = gtk_builder_get_object(builder,"upperleg_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( upperleg)); /* checkbutton for right leg */ checkbutton = gtk_builder_get_object(builder,"leg_right"); g_signal_connect(checkbutton,"clicked", G_CALLBACK(toggle_button_callback), GINT_TO_POINTER( leg)); /* * AND ENDS HERE! */ /* spinbutton for height */ spin = gtk_builder_get_object(builder,"height"); GtkSpinButton *height_spinner = (GtkSpinButton *) spin; gtk_spin_button_set_increments( height_spinner,1,1); gtk_spin_button_set_range( height_spinner,0,300); /* spinbutton for weight */ spin = gtk_builder_get_object(builder,"weight"); GtkSpinButton *weight_spinner = (GtkSpinButton *) spin; gtk_spin_button_set_increments( weight_spinner,1,1); gtk_spin_button_set_range( weight_spinner,0,500); /* calculate button */ button = gtk_builder_get_object(builder,"calculate"); weight = g_signal_connect(button,"clicked",G_CALLBACK(get_int_weight_spin_button),weight_spinner); height = g_signal_connect(button,"clicked",G_CALLBACK(get_double_height_spin_button),height_spinner); g_signal_connect(button,"clicked",G_CALLBACK(calculate),NULL); /* getting label for bmi */ label = gtk_builder_get_object(builder,"bmi"); GtkLabel *bmi_label = (GtkLabel *) label; g_signal_connect(button, "clicked", G_CALLBACK(set_text), bmi_label); button = gtk_builder_get_object(builder,"reset"); g_signal_connect(button,"clicked", G_CALLBACK(reset), builder); //g_signal_connect(button,"clicked", G_CALLBACK(gtk_window_new),window); gtk_main (); return 0; }
static void seahorse_pkcs11_generate_constructed (GObject *obj) { SeahorsePkcs11Generate *self = SEAHORSE_PKCS11_GENERATE (obj); GtkCellRenderer *renderer; GcrCollection *collection; GtkBuilder *builder; const gchar *path; GError *error = NULL; GtkWidget *content; GtkWidget *widget; G_OBJECT_CLASS (seahorse_pkcs11_generate_parent_class)->constructed (obj); builder = gtk_builder_new (); path = "/org/gnome/Seahorse/seahorse-pkcs11-generate.xml"; gtk_builder_add_from_resource (builder, path, &error); if (error != NULL) { g_warning ("couldn't load ui file: %s", path); g_clear_error (&error); g_object_unref (builder); return; } gtk_window_set_resizable (GTK_WINDOW (self), FALSE); content = gtk_dialog_get_content_area (GTK_DIALOG (self)); widget = GTK_WIDGET (gtk_builder_get_object (builder, "pkcs11-generate")); gtk_container_add (GTK_CONTAINER (content), widget); gtk_widget_show (widget); self->bits_entry = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "key-bits")); gtk_spin_button_set_range (self->bits_entry, 0, G_MAXINT); /* updated later */ gtk_spin_button_set_increments (self->bits_entry, 128, 128); gtk_spin_button_set_value (self->bits_entry, 2048); self->label_entry = GTK_ENTRY (gtk_builder_get_object (builder, "key-label")); /* The mechanism */ self->mechanism_box = GTK_COMBO_BOX (gtk_builder_get_object (builder, "key-mechanism")); G_STATIC_ASSERT (MECHANISM_N_COLS == G_N_ELEMENTS (MECHANISM_TYPES)); self->mechanism_store = gtk_list_store_newv (MECHANISM_N_COLS, MECHANISM_TYPES); gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (self->mechanism_store), on_mechanism_sort, NULL, NULL); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->mechanism_store), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); gtk_combo_box_set_model (self->mechanism_box, GTK_TREE_MODEL (self->mechanism_store)); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->mechanism_box), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self->mechanism_box), renderer, "markup", MECHANISM_LABEL); g_signal_connect (self->mechanism_box, "changed", G_CALLBACK (on_mechanism_changed), self); /* The tokens */ self->token_box = GTK_COMBO_BOX (gtk_builder_get_object (builder, "key-token")); collection = seahorse_pkcs11_backend_get_writable_tokens (NULL, CKM_RSA_PKCS_KEY_PAIR_GEN); self->token_model = gcr_collection_model_new (collection, GCR_COLLECTION_MODEL_LIST, "icon", G_TYPE_ICON, "label", G_TYPE_STRING, NULL); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->token_model), 1, GTK_SORT_ASCENDING); gtk_combo_box_set_model (self->token_box, GTK_TREE_MODEL (self->token_model)); renderer = gtk_cell_renderer_pixbuf_new (); g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->token_box), renderer, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self->token_box), renderer, "gicon", 0); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->token_box), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self->token_box), renderer, "text", 1); g_signal_connect (self->token_box, "changed", G_CALLBACK (on_token_changed), self); if (gcr_collection_get_length (collection) > 0) gtk_combo_box_set_active (self->token_box, 0); g_object_unref (collection); /* The buttons */ gtk_dialog_add_buttons (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Create"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK); update_response (self); g_object_unref (builder); }
void ui_common_study_preferences_widgets(GtkWidget * packing_table, gint table_row, GtkWidget ** proi_width_spin, GnomeCanvasItem ** proi_item, #ifdef AMIDE_LIBGNOMECANVAS_AA GtkWidget ** proi_transparency_spin, #else GtkWidget ** pline_style_menu, GtkWidget ** pfill_roi_button, #endif GtkWidget ** playout_button1, GtkWidget ** playout_button2, GtkWidget ** ppanel_layout_button1, GtkWidget ** ppanel_layout_button2, GtkWidget ** ppanel_layout_button3, GtkWidget ** pmaintain_size_button, GtkWidget ** ptarget_size_spin) { GtkWidget * label; GtkObject * adjustment; GtkWidget * roi_canvas; GnomeCanvasPoints * roi_line_points; GtkWidget * image; GtkWidget * hseparator; #ifndef AMIDE_LIBGNOMECANVAS_AA GdkLineStyle i_line_style; #endif /* widgets to change the roi's size */ label = gtk_label_new(_("ROI Width (pixels)")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); adjustment = gtk_adjustment_new(AMITK_PREFERENCES_MIN_ROI_WIDTH, AMITK_PREFERENCES_MIN_ROI_WIDTH, AMITK_PREFERENCES_MAX_ROI_WIDTH,1.0, 1.0, 0.0); *proi_width_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*proi_width_spin),FALSE); gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(*proi_width_spin), TRUE); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*proi_width_spin), TRUE); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(*proi_width_spin), GTK_UPDATE_ALWAYS); gtk_table_attach(GTK_TABLE(packing_table), *proi_width_spin, 1,2, table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING); gtk_widget_show(*proi_width_spin); /* a little canvas indicator thingie to show the user who the new preferences will look */ #ifdef AMIDE_LIBGNOMECANVAS_AA roi_canvas = gnome_canvas_new_aa(); #else roi_canvas = gnome_canvas_new(); #endif gtk_widget_set_size_request(roi_canvas, 100, 100); gnome_canvas_set_scroll_region(GNOME_CANVAS(roi_canvas), 0.0, 0.0, 100.0, 100.0); gtk_table_attach(GTK_TABLE(packing_table), roi_canvas, 2,3,table_row,table_row+2, GTK_FILL, 0, X_PADDING, Y_PADDING); gtk_widget_show(roi_canvas); /* the box */ roi_line_points = gnome_canvas_points_new(5); roi_line_points->coords[0] = 25.0; /* x1 */ roi_line_points->coords[1] = 25.0; /* y1 */ roi_line_points->coords[2] = 75.0; /* x2 */ roi_line_points->coords[3] = 25.0; /* y2 */ roi_line_points->coords[4] = 75.0; /* x3 */ roi_line_points->coords[5] = 75.0; /* y3 */ roi_line_points->coords[6] = 25.0; /* x4 */ roi_line_points->coords[7] = 75.0; /* y4 */ roi_line_points->coords[8] = 25.0; /* x4 */ roi_line_points->coords[9] = 25.0; /* y4 */ *proi_item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(roi_canvas)), #ifdef AMIDE_LIBGNOMECANVAS_AA gnome_canvas_polygon_get_type(), #else gnome_canvas_line_get_type(), #endif "points", roi_line_points, NULL); gnome_canvas_points_unref(roi_line_points); table_row++; #ifdef AMIDE_LIBGNOMECANVAS_AA /* widget to change the transparency level */ /* only works for anti-aliased canvases */ /* widgets to change the roi's size */ label = gtk_label_new(_("ROI Transparency")); gtk_table_attach(GTK_TABLE(packing_table), label, 0, 1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); *proi_transparency_spin = gtk_spin_button_new_with_range(0.0,1.0,AMITK_PREFERENCES_DEFAULT_CANVAS_ROI_TRANSPARENCY); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(*proi_transparency_spin),0.1,0.1); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*proi_transparency_spin),FALSE); gtk_table_attach(GTK_TABLE(packing_table), *proi_transparency_spin, 1,2, table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING); gtk_widget_show(*proi_transparency_spin); table_row++; #else /* widgets to change the roi's line style */ /* Anti-aliased canvas doesn't yet support this */ /* also need to remove #ifndef for relevant lines in amitk_canvas_object.c and other locations */ label = gtk_label_new(_("ROI Line Style:")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); *pline_style_menu = gtk_combo_box_new_text(); for (i_line_style=0; i_line_style<=GDK_LINE_DOUBLE_DASH; i_line_style++) gtk_combo_box_append_text(GTK_COMBO_BOX(*pline_style_menu), line_style_names[i_line_style]); gtk_widget_set_size_request (*pline_style_menu, 125, -1); gtk_table_attach(GTK_TABLE(packing_table), *pline_style_menu, 1,2, table_row,table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING); gtk_widget_show(*pline_style_menu); table_row++; /* do we want to fill in isocontour roi's */ label = gtk_label_new(_("Draw Isocontours/Freehands Filled:")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); *pfill_roi_button = gtk_check_button_new(); gtk_table_attach(GTK_TABLE(packing_table), *pfill_roi_button, 1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(*pfill_roi_button); table_row++; #endif hseparator = gtk_hseparator_new(); gtk_table_attach(GTK_TABLE(packing_table), hseparator, 0, 3, table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING); table_row++; gtk_widget_show(hseparator); label = gtk_label_new(_("Canvas Layout:")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); /* the radio buttons */ *playout_button1 = gtk_radio_button_new(NULL); image = gtk_image_new_from_stock("amide_icon_layout_linear",GTK_ICON_SIZE_DIALOG); gtk_button_set_image(GTK_BUTTON(*playout_button1), image); gtk_table_attach(GTK_TABLE(packing_table), *playout_button1, 1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); g_object_set_data(G_OBJECT(*playout_button1), "layout", GINT_TO_POINTER(AMITK_LAYOUT_LINEAR)); gtk_widget_show(*playout_button1); *playout_button2 = gtk_radio_button_new(NULL); gtk_radio_button_set_group(GTK_RADIO_BUTTON(*playout_button2), gtk_radio_button_get_group(GTK_RADIO_BUTTON(*playout_button1))); image = gtk_image_new_from_stock("amide_icon_layout_orthogonal",GTK_ICON_SIZE_DIALOG); gtk_button_set_image(GTK_BUTTON(*playout_button2), image); gtk_table_attach(GTK_TABLE(packing_table), *playout_button2, 2,3, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); g_object_set_data(G_OBJECT(*playout_button2), "layout", GINT_TO_POINTER(AMITK_LAYOUT_ORTHOGONAL)); gtk_widget_show(*playout_button2); table_row++; label = gtk_label_new(_("Multiple Canvases Layout:")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); /* the radio buttons */ *ppanel_layout_button1 = gtk_radio_button_new(NULL); image = gtk_image_new_from_stock("amide_icon_panels_mixed", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button1), image); gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button1, 1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); g_object_set_data(G_OBJECT(*ppanel_layout_button1), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_MIXED)); gtk_widget_show(*ppanel_layout_button1); *ppanel_layout_button2 = gtk_radio_button_new(NULL); gtk_radio_button_set_group(GTK_RADIO_BUTTON(*ppanel_layout_button2), gtk_radio_button_get_group(GTK_RADIO_BUTTON(*ppanel_layout_button1))); image = gtk_image_new_from_stock("amide_icon_panels_linear_x", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button2), image); gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button2, 2,3, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); g_object_set_data(G_OBJECT(*ppanel_layout_button2), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_LINEAR_X)); gtk_widget_show(*ppanel_layout_button2); *ppanel_layout_button3 = gtk_radio_button_new(NULL); gtk_radio_button_set_group(GTK_RADIO_BUTTON(*ppanel_layout_button3), gtk_radio_button_get_group(GTK_RADIO_BUTTON(*ppanel_layout_button1))); image = gtk_image_new_from_stock("amide_icon_panels_linear_y", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button3), image); gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button3, 3,4, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); g_object_set_data(G_OBJECT(*ppanel_layout_button3), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_LINEAR_Y)); gtk_widget_show(*ppanel_layout_button3); table_row++; /* do we want the size of the canvas to not resize */ label = gtk_label_new(_("Maintain view size constant:")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); *pmaintain_size_button = gtk_check_button_new(); gtk_table_attach(GTK_TABLE(packing_table), *pmaintain_size_button, 1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(*pmaintain_size_button); table_row++; /* widgets to change the amount of empty space in the center of the target */ label = gtk_label_new(_("Target Empty Area (pixels)")); gtk_table_attach(GTK_TABLE(packing_table), label, 0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING); gtk_widget_show(label); adjustment = gtk_adjustment_new(AMITK_PREFERENCES_MIN_TARGET_EMPTY_AREA, AMITK_PREFERENCES_MIN_TARGET_EMPTY_AREA, AMITK_PREFERENCES_MAX_TARGET_EMPTY_AREA, 1.0, 1.0, 0.0); *ptarget_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*ptarget_size_spin),FALSE); gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(*ptarget_size_spin), TRUE); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*ptarget_size_spin), TRUE); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(*ptarget_size_spin), GTK_UPDATE_ALWAYS); gtk_table_attach(GTK_TABLE(packing_table), *ptarget_size_spin, 1,2, table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING); gtk_widget_show(*ptarget_size_spin); return; }
static void create_dialog(void) { GtkWidget *vbox, *hbox, *vbox2, *notebook, *w; if (options_dialog) return; vbox = gtk_vbox_new(FALSE, 0); /* Buttons box */ hbox = gtk_hbutton_box_new(); gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); #if GTK_CHECK_VERSION(2, 14, 0) /* Help button */ gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_EDGE); w = gtk_button_new_from_stock(GTK_STOCK_HELP); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(help_clicked), NULL); gtk_tooltips_set_tip(tooltips, w, "Launch program website", NULL); #endif /* Close button */ w = gtk_button_new_with_label("Close"); gtk_button_set_image(GTK_BUTTON(w), gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_BUTTON)); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(close_dialog), NULL); gtk_box_pack_end(GTK_BOX(vbox), spacer_new(-1, 8), FALSE, TRUE, 0); /* Create notebook */ notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); /* View page */ vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8); w = gtk_label_new("Interface"); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w); /* View -> Dimensions */ w = label_new_markup("<b>Dimensions</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* View -> Dimensions -> Cell size */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = label_new_markup("Cells: "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); cell_width_spin = spin_button_new_int(CELL_WIDTH_MIN, cell_height, &cell_width, TRUE); g_signal_connect(G_OBJECT(cell_width_spin), "value-changed", G_CALLBACK(cell_width_value_changed), NULL); gtk_box_pack_start(GTK_BOX(hbox), cell_width_spin, FALSE, FALSE, 0); w = label_new_markup(" by "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); cell_height_spin = spin_button_new_int(cell_width, CELL_HEIGHT_MAX, &cell_height, TRUE); cell_width_value_changed(); g_signal_connect(G_OBJECT(cell_height_spin), "value-changed", G_CALLBACK(cell_height_value_changed), NULL); gtk_box_pack_start(GTK_BOX(hbox), cell_height_spin, FALSE, FALSE, 0); w = label_new_markup(" pixels"); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Dimensions -> Grid */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = label_new_markup("Grid: "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = spin_button_new_int(6, 48, &cell_cols_pref, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = label_new_markup(" by "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = spin_button_new_int(1, 8, &cell_rows_pref, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = label_new_markup(" cells"); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Dimensions -> Keyboard size */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = label_new_markup("Keyboard: "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = spin_button_new_int(KEYBOARD_SIZE_MIN, 1400, &keyboard_size, TRUE); gtk_spin_button_set_increments(GTK_SPIN_BUTTON(w), 16, 4); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = label_new_markup(" pixels wide"); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Window */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); w = label_new_markup("<b>Window</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* View -> Window -> Button labels */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Show button labels", &window_button_labels, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Window -> On-screen keyboard */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Show on-screen keyboard", &keyboard_enabled, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Window -> Enable */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Enable extended input events", &xinput_enabled, FALSE); g_signal_connect(G_OBJECT(w), "toggled", G_CALLBACK(xinput_enabled_toggled), NULL); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "If you cannot write in the cells or the ink " "does not appear where it should, you can try " "disabling extended input events. Note that this " "will disable the pen eraser.", NULL); /* View -> Window -> Docking */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = label_new_markup("Window docking: "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Disabled"); gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Top"); gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Bottom"); gtk_combo_box_set_active(GTK_COMBO_BOX(w), window_docked); g_signal_connect(G_OBJECT(w), "changed", G_CALLBACK(window_docking_changed), NULL); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* View -> Status icon */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); w = label_new_markup("<b>Status icon</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* View -> Status icon -> Enable */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Open menu on left click", &status_menu_left_click, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* Colors page */ vbox2 = gtk_vbox_new(FALSE, 0); w = gtk_label_new("Colors"); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8); /* Colors -> Use style */ w = check_button_new("Use default theme colors", &style_colors, FALSE); g_signal_connect(G_OBJECT(w), "toggled", G_CALLBACK(style_colors_changed), NULL); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* Colors -> Custom colors */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); color_table = create_color_table(); gtk_box_pack_start(GTK_BOX(vbox2), color_table, FALSE, FALSE, 0); style_colors_changed(); /* Unicode page */ vbox2 = gtk_vbox_new(FALSE, 0); w = gtk_label_new("Languages"); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8); /* Unicode -> Displayed blocks */ w = label_new_markup("<b>Enabled Unicode blocks</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(-1, 4), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); /* Unicode -> Blocks list */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = create_blocks_list(); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0); /* Recognition -> Duplicate glyphs */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); w = label_new_markup("<b>Language options</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* Unicode -> Disable Latin letters */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Disable Basic Latin letters", &no_latin_alpha, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "If you have trained both the Basic Latin block " "and a block with characters similar to Latin " "letters (for instance, Cyrillic) you can disable " "the Basic Latin letters in order to use only " "numbers and symbols from Basic Latin.", NULL); /* Unicode -> Right-to-left */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Enable right-to-left mode", &right_to_left, TRUE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, PACKAGE_NAME " will expect you to write from " "the rightmost cell to the left and will pad " "cells and create new lines accordingly.", NULL); /* Recognition page */ vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8); w = gtk_label_new("Recognition"); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w); /* Recognition -> Samples */ w = label_new_markup("<b>Training samples</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* Recognition -> Samples -> Train on input */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Train on input when entering", &train_on_input, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "When enabled, input characters will be used as " "training samples when 'Enter' is pressed. This " "is a good way to quickly build up many samples, " "but can generate poor samples if your writing " "gets sloppy.", NULL); /* Recognition -> Samples -> Maximum */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = label_new_markup("Samples per character: "); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); w = spin_button_new_int(2, SAMPLES_MAX, &samples_max, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "The maximum number of training samples kept per " "character. Lower this value if recognition is " "too slow or the program uses too much memory.", NULL); /* Recognition -> Word context */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); w = label_new_markup("<b>Word context</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* Recognition -> Word context -> English */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Enable English word context", &wordfreq_enable, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "Use a dictionary of the most frequent English " "words to assist recognition. Also aids in " "consistent recognition of numbers and " "capitalization.", NULL); /* Recognition -> Preprocessor */ gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0); w = label_new_markup("<b>Preprocessor</b>"); gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0); /* Recognition -> Preprocessor -> Ignore stroke direction */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Ignore stroke direction", &ignore_stroke_dir, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "Match input strokes with training sample strokes " "that were drawn in the opposite direction. " "Disabling this can boost recognition speed.", NULL); /* Recognition -> Preprocessor -> Ignore stroke number */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0); w = check_button_new("Match differing stroke numbers", &ignore_stroke_num, FALSE); gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); gtk_tooltips_set_tip(tooltips, w, "Match inputs to training samples that do not " "have the same number of strokes. Disabling this " "can boost recognition speed.", NULL); /* Create dialog window */ options_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(options_dialog), "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); gtk_window_set_destroy_with_parent(GTK_WINDOW(options_dialog), TRUE); gtk_window_set_resizable(GTK_WINDOW(options_dialog), TRUE); gtk_window_set_title(GTK_WINDOW(options_dialog), "CellWriter Setup"); gtk_container_set_border_width(GTK_CONTAINER(options_dialog), 8); gtk_container_add(GTK_CONTAINER(options_dialog), vbox); if (!window_embedded) gtk_window_set_transient_for(GTK_WINDOW(options_dialog), GTK_WINDOW(window)); }
static void setup_datetime_dialog (CcDateTimePanel *self) { CcDateTimePanelPrivate *priv = self->priv; GtkAdjustment *adjustment; GdkScreen *screen; GtkCssProvider *provider; GtkWidget *dialog; guint num_days; setup_am_pm_button (self); /* Big time buttons */ provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), ".gnome-control-center-datetime-setup-time>spinbutton,\n" ".gnome-control-center-datetime-setup-time>label {\n" " font-size: 250%;\n" "}\n" ".gnome-control-center-datetime-setup-time>spinbutton>entry {\n" " padding: 8px 13px;\n" "}", -1, NULL); screen = gdk_screen_get_default (); gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); dialog = W ("datetime-dialog"); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); /* Force the direction for the time, so that the time * is presented correctly for RTL languages */ gtk_widget_set_direction (W ("time_grid"), GTK_TEXT_DIR_LTR); /* Month */ gtk_combo_box_set_active (GTK_COMBO_BOX (W ("month-combobox")), g_date_time_get_month (priv->date) - 1); g_signal_connect (G_OBJECT (W("month-combobox")), "changed", G_CALLBACK (month_year_changed), self); /* Day */ num_days = g_date_get_days_in_month (g_date_time_get_month (priv->date), g_date_time_get_year (priv->date)); adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_day_of_month (priv->date), 1, num_days + 1, 1, 10, 1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("day-spinbutton")), adjustment); g_signal_connect (G_OBJECT (W ("day-spinbutton")), "value-changed", G_CALLBACK (day_changed), self); /* Year */ adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_year (priv->date), 1, G_MAXDOUBLE, 1, 10, 1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("year-spinbutton")), adjustment); g_signal_connect (G_OBJECT (W ("year-spinbutton")), "value-changed", G_CALLBACK (month_year_changed), self); /* Hours and minutes */ g_signal_connect (W ("h_spinbutton"), "output", G_CALLBACK (format_hours_combobox), self); g_signal_connect (W ("m_spinbutton"), "output", G_CALLBACK (format_minutes_combobox), self); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (W ("h_spinbutton")), 1, 0); gtk_spin_button_set_increments (GTK_SPIN_BUTTON (W ("m_spinbutton")), 1, 0); gtk_spin_button_set_range (GTK_SPIN_BUTTON (W ("h_spinbutton")), 0, 23); gtk_spin_button_set_range (GTK_SPIN_BUTTON (W ("m_spinbutton")), 0, 59); g_signal_connect_swapped (W ("h_spinbutton"), "value-changed", G_CALLBACK (change_time), self); g_signal_connect_swapped (W ("m_spinbutton"), "value-changed", G_CALLBACK (change_time), self); }