Home button in help window added

parent 0f313ceb
......@@ -73,6 +73,13 @@ void CoXHelpGtk::activate_back( GtkWidget *w, gpointer data)
xhelp->back();
}
void CoXHelpGtk::activate_home( GtkWidget *w, gpointer data)
{
CoXHelpGtk *xhelp = (CoXHelpGtk *)data;
xhelp->home();
}
void CoXHelpGtk::activate_nexttopic( GtkWidget *w, gpointer data)
{
CoXHelpGtk *xhelp = (CoXHelpGtk *)data;
......@@ -263,6 +270,12 @@ CoXHelpGtk::CoXHelpGtk(
GtkWidget *file_close = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, accel_g);
g_signal_connect(file_close, "activate", G_CALLBACK(CoXHelpGtk::activate_close), this);
GtkWidget *file_home = gtk_menu_item_new_with_mnemonic( "_Home");
g_signal_connect( file_home, "activate",
G_CALLBACK(activate_home), this);
gtk_widget_add_accelerator( file_home, "activate", accel_g,
'a', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
GtkWidget *file_back = gtk_menu_item_new_with_mnemonic( "_Back");
g_signal_connect( file_back, "activate",
G_CALLBACK(activate_back), this);
......@@ -283,6 +296,7 @@ CoXHelpGtk::CoXHelpGtk(
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_home);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_back);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_nexttopic);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_prevtopic);
......@@ -305,7 +319,7 @@ CoXHelpGtk::CoXHelpGtk(
g_signal_connect( edit_searchprevious, "activate",
G_CALLBACK(CoXHelpGtk::activate_searchprevious), this);
gtk_widget_add_accelerator( edit_searchprevious, "activate", accel_g,
'g', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
'd', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
GtkMenu *edit_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_search);
......@@ -352,6 +366,14 @@ CoXHelpGtk::CoXHelpGtk(
// Toolbar
GtkWidget *tools_home = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_home.png");
gtk_container_add( GTK_CONTAINER(tools_home),
gtk_image_new_from_file( fname));
g_signal_connect(tools_home, "clicked", G_CALLBACK(activate_home), this);
g_object_set( tools_home, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_home,CoWowGtk::translate_utf8("Go to start page"), "");
GtkWidget *tools_back = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_back.png");
gtk_container_add( GTK_CONTAINER(tools_back),
......
......@@ -53,6 +53,7 @@ class CoXHelpGtk : public CoXHelp {
const char *init_text,
void (*ok_cb)( CoXHelp *, char *));
static void activate_close( GtkWidget *w, gpointer data);
static void activate_home( GtkWidget *w, gpointer data);
static void activate_back( GtkWidget *w, gpointer data);
static void activate_nexttopic( GtkWidget *w, gpointer data);
static void activate_previoustopic( GtkWidget *w, gpointer data);
......
......@@ -74,6 +74,11 @@ int CoXHelp::help( const char *key, const char *help_bookmark, navh_eHelpFile fi
file_name, 0, strict);
}
int CoXHelp::home()
{
return xhelpnav->home();
}
int CoXHelp::back()
{
return xhelpnav->back();
......
......@@ -54,6 +54,7 @@ class CoXHelp {
int help( const char *key, const char *help_bookmark, navh_eHelpFile file_type,
const char *file_name, bool strict);
int help_index( navh_eHelpFile file_type, const char *file_name);
int home();
int back();
int next_topic();
int previous_topic();
......
......@@ -164,7 +164,7 @@ void CoXHelpNavBrow::create_nodeclasses()
brow_AddAnnot( nc_object, 11, 0.6, 2,
flow_eDrawType_TextHelveticaBold, 2, flow_eAnnotType_OneLine,
1);
brow_AddFrame( nc_object, 0, 0, 20, 0.8, flow_eDrawType_LineGray, -1, 1);
brow_AddFrame( nc_object, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
// Create text
......@@ -181,7 +181,7 @@ void CoXHelpNavBrow::create_nodeclasses()
brow_AddAnnot( nc_text, 11, 0.6, 2,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddFrame( nc_text, 0, 0, 20, 0.8, flow_eDrawType_LineGray, -1, 1);
brow_AddFrame( nc_text, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
// Create Header
......@@ -1214,6 +1214,29 @@ int CoXHelpNav::help( const char *help_key, const char *help_bookmark,
return 1;
}
int CoXHelpNav::home()
{
navh_eHelpFile current_filetype;
char topic[80] = "index";
pwr_tFileName current_filename = "";
current_filetype = brow_stack[0]->current_filetype;
if ( current_filetype == navh_eHelpFile_Other)
strncpy( current_filename, brow_stack[0]->current_filename, sizeof(current_filename));
// if ( current_filetype == navh_eHelpFile_Other)
// current_filetype = navh_eHelpFile_Project;
if ( current_filetype == navh_eHelpFile_Base /*&& utility == xhelp_eUtility_Xtt*/)
strcpy( topic, "overview");
brow_push_all();
clear();
help( topic, 0, current_filetype, current_filename[0] == 0 ? 0 : current_filename, 0, 0);
return 1;
}
int CoXHelpNav::back()
{
brow_push();
......
......@@ -135,6 +135,7 @@ class CoXHelpNav {
void enable_events( CoXHelpNavBrow *brow);
int help( const char *key, const char *help_bookmark, navh_eHelpFile file_type,
const char *file_name, int pop, bool strict);
int home();
int back();
int next_topic();
int previous_topic();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment