G_MODULE_EXPORT void on_plot_item_activate( GtkObject *object, gpointer user_data) { const gchar *label= gtk_menu_item_get_label(GTK_MENU_ITEM(object)); char *plot1_commands[]= { "plotall", "plotover", "plotsr" }; char *plot2_commands[]= { "plotauto", "plotlog", "plotsame", "plotscale", "pa" }; int found= FALSE; char temporary[512]; int ii; strcpy(temporary, label); strtolower(temporary); // expects to have ellipsis at the end.. if(strlen(temporary)>3) { temporary[strlen(temporary)-3]= '\0'; } for(ii= 0; ii<ARRAY_SIZE(plot1_commands); ii++) { if(strcmp(plot1_commands[ii], temporary)==0) { strcpy(plot_cmd, temporary); set_left_footer("Type the x-axis and y-axis"); set_cmd_prompt("X-AXIS Y-AXIS: "); ui_globals.action = PLOT_GET_XY; found= TRUE; } } if(!found) { for(ii= 0; ii<ARRAY_SIZE(plot2_commands); ii++) { if(strcmp(plot2_commands[ii], temporary)==0) { strcpy(plot_cmd, temporary); set_left_footer("Type the x-axis and y-axis"); set_cmd_prompt("X-AXIS Y-AXIS: "); ui_globals.action = PLOT_GET_BE; found= TRUE; } } } if(!found) { fprintf(stderr, "Didn't find plot command: %s\n", temporary); } }
bool edit_interface_rep::set_latex_footer (tree st) { if (is_atomic (st)) if (is_func (subtree (et, path_up (tp, 2)), LATEX, 1) || is_func (subtree (et, path_up (tp, 2)), HYBRID, 1)) { string s= st->label; string help; command cmd; if (sv->kbd_get_command (s, help, cmd)) { set_left_footer (concat (kbd ("return"), ": " * help)); set_right_footer ("latex command"); return true; } } return false; }
void edit_interface_rep::set_left_footer () { tree s= concat (); double base_sz= get_env_int (FONT_BASE_SIZE); double sz= get_env_double (FONT_SIZE); /* tree the_style= get_style (); for (int i=0; i<arity (the_style); i++) s << " " << as_string (the_style[i]); */ string mode= get_env_string (MODE); string lan = get_env_string (MODE_LANGUAGE (mode)); if (mode == "prog") s << "program"; else if (as_string (get_init_value (MODE_LANGUAGE (mode))) != lan) s << " " << lan; else s << " " << mode; if ((mode == "text") || (mode == "src")) { s << " " << get_env_string (FONT); append_left_footer (s, FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, FONT_SERIES); append_left_footer (s, FONT_SHAPE); } else if (mode == "math") { s << " " << get_env_string (MATH_FONT); append_left_footer (s, MATH_FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, MATH_FONT_SERIES); append_left_footer (s, MATH_FONT_SHAPE); } else if (mode == "prog") { string session_name= get_env_string (PROG_SESSION); if (session_name != "default") s << "-" << session_name; s << " " << get_env_string (PROG_FONT); append_left_footer (s, PROG_FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, PROG_FONT_SERIES); append_left_footer (s, PROG_FONT_SHAPE); } string r= get_env_string (COLOR); if (r != "black") s << " " << r; if (N(s) > 0 && s[0] == " ") s= s (1, N(s)); if (inside ("session") && (lan != "scheme")) { string lan = get_env_string (PROG_LANGUAGE); string session= get_env_string (PROG_SESSION); switch (connection_status (lan, session)) { case CONNECTION_DEAD: s= s << " [dead]"; break; case CONNECTION_DYING: case WAITING_FOR_OUTPUT: s= s << " [busy]"; break; case WAITING_FOR_INPUT: s= s << " [idle]"; break; } } s= as_tree (call ("footer-hook", object (s))); set_left_footer (s); }
void edit_interface_rep::set_left_footer (tree l) { SERVER (set_left_footer (translate (l))); }