gtk: preliminary hotkey configuration dialog (currently read-only and menu items commented)
This commit is contained in:
parent
792754a7e9
commit
d2c378a434
|
@ -425,41 +425,66 @@ void openNetworkConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates and opens hotkey config window
|
// creates and opens hotkey config window
|
||||||
/*void openHotkeyConfig()
|
void openHotkeyConfig()
|
||||||
{
|
{
|
||||||
std::string prefix = "SDL.Hotkeys.";
|
std::string prefix = "SDL.Hotkeys.";
|
||||||
GtkWidget* win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
GtkWidget* win = gtk_dialog_new_with_buttons("Hotkey Configuration",
|
||||||
|
GTK_WINDOW(MainWindow),
|
||||||
|
(GtkDialogFlags)(GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||||
|
GTK_STOCK_CLOSE,
|
||||||
|
GTK_RESPONSE_OK,
|
||||||
|
NULL);
|
||||||
|
GtkWidget *tree;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
|
||||||
|
vbox = gtk_dialog_get_content_area(GTK_DIALOG(win));
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
COMMAND_COLUMN,
|
COMMAND_COLUMN,
|
||||||
|
// ACTION_COLUMN,
|
||||||
KEY_COLUMN,
|
KEY_COLUMN,
|
||||||
N_COLUMNS
|
N_COLUMNS
|
||||||
};
|
};
|
||||||
GtkListStore* store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
|
GtkTreeStore* store = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter; // parent
|
||||||
|
GtkTreeIter iter2; // child
|
||||||
|
|
||||||
gtk_list_store_append(store, &iter); // aquire iter
|
gtk_tree_store_append(store, &iter, NULL); // aquire iter
|
||||||
|
|
||||||
|
|
||||||
int buf;
|
int keycode;
|
||||||
for(int i=0; i<HK_MAX; i++)
|
for(int i=0; i<HK_MAX; i++)
|
||||||
{
|
{
|
||||||
//g_config->getOption(prefix + HotkeyStrings[i], &buf);
|
const char* optionName = (prefix + HotkeyStrings[i]).c_str();
|
||||||
gtk_list_store_set(store, &iter,
|
g_config->getOption(optionName, &keycode);
|
||||||
COMMAND_COLUMN, prefix + HotkeyStrings[i],
|
gtk_tree_store_set(store, &iter,
|
||||||
KEY_COLUMN, "TODO", -1);
|
COMMAND_COLUMN, optionName,
|
||||||
|
// ACTION_COLUMN, "This hotkey does this.",
|
||||||
|
KEY_COLUMN, keycode,
|
||||||
|
-1);
|
||||||
|
gtk_tree_store_append(store, &iter, NULL); // acquire child iterator
|
||||||
}
|
}
|
||||||
GtkWidget* tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn* column;
|
||||||
|
|
||||||
|
|
||||||
renderer = gtk_cell_renderer_text_new();
|
renderer = gtk_cell_renderer_text_new();
|
||||||
column = gtk_tree_view_column_new_with_attributes("Command", renderer, "text", 0, NULL);
|
column = gtk_tree_view_column_new_with_attributes("Command", renderer, "text", COMMAND_COLUMN, NULL);
|
||||||
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||||
|
// column = gtk_tree_view_column_new_with_attributes("Action", renderer, "text", ACTION_COLUMN, NULL);
|
||||||
|
// gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||||
|
column = gtk_tree_view_column_new_with_attributes("Key", renderer, "text", KEY_COLUMN, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(win),tree);
|
gtk_container_add(GTK_CONTAINER(win),vbox);
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), tree , TRUE, TRUE, 5);
|
||||||
gtk_widget_show_all(win);
|
gtk_widget_show_all(win);
|
||||||
}*/
|
|
||||||
|
g_signal_connect(win, "delete-event", G_CALLBACK(closeDialog), NULL);
|
||||||
|
g_signal_connect(win, "response", G_CALLBACK(closeDialog), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget* typeCombo;
|
GtkWidget* typeCombo;
|
||||||
|
|
||||||
// TODO: finish this
|
// TODO: finish this
|
||||||
|
@ -474,12 +499,6 @@ int setInputDevice(GtkWidget* w, gpointer p)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean closeGamepadConfig(GtkWidget* w, GdkEvent* event, gpointer p)
|
|
||||||
{
|
|
||||||
gtk_widget_destroy(w);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateGamepadConfig(GtkWidget* w, gpointer p)
|
void updateGamepadConfig(GtkWidget* w, gpointer p)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -637,8 +656,8 @@ void openGamepadConfig()
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), buttonFrame, TRUE, TRUE, 5);
|
gtk_box_pack_start(GTK_BOX(vbox), buttonFrame, TRUE, TRUE, 5);
|
||||||
|
|
||||||
g_signal_connect(win, "delete-event", G_CALLBACK(closeGamepadConfig), NULL);
|
g_signal_connect(win, "delete-event", G_CALLBACK(closeDialog), NULL);
|
||||||
g_signal_connect(win, "response", G_CALLBACK(closeGamepadConfig), NULL);
|
g_signal_connect(win, "response", G_CALLBACK(closeDialog), NULL);
|
||||||
|
|
||||||
gtk_widget_show_all(win);
|
gtk_widget_show_all(win);
|
||||||
|
|
||||||
|
@ -2034,6 +2053,7 @@ static char* menuXml =
|
||||||
" </menu>"
|
" </menu>"
|
||||||
" <menu action='OptionsMenuAction'>"
|
" <menu action='OptionsMenuAction'>"
|
||||||
" <menuitem action='GamepadConfigAction' />"
|
" <menuitem action='GamepadConfigAction' />"
|
||||||
|
// " <menuitem action='HotkeyConfigAction' />"
|
||||||
" <menuitem action='SoundConfigAction' />"
|
" <menuitem action='SoundConfigAction' />"
|
||||||
" <menuitem action='VideoConfigAction' />"
|
" <menuitem action='VideoConfigAction' />"
|
||||||
" <menuitem action='PaletteConfigAction' />"
|
" <menuitem action='PaletteConfigAction' />"
|
||||||
|
@ -2092,6 +2112,7 @@ static GtkActionEntry normal_entries[] = {
|
||||||
#if GTK_MAJOR_VERSION == 3 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24)
|
#if GTK_MAJOR_VERSION == 3 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24)
|
||||||
{"GamepadConfigAction", "input-gaming", "_Gamepad Config", NULL, NULL, G_CALLBACK(openGamepadConfig)},
|
{"GamepadConfigAction", "input-gaming", "_Gamepad Config", NULL, NULL, G_CALLBACK(openGamepadConfig)},
|
||||||
#endif
|
#endif
|
||||||
|
// {"HotkeyConfigAction", "input", "_Hotkey Config", NULL, NULL, G_CALLBACK(openHotkeyConfig)},
|
||||||
{"SoundConfigAction", "audio-x-generic", "_Sound Config", NULL, NULL, G_CALLBACK(openSoundConfig)},
|
{"SoundConfigAction", "audio-x-generic", "_Sound Config", NULL, NULL, G_CALLBACK(openSoundConfig)},
|
||||||
{"VideoConfigAction", "video-display", "_Video Config", NULL, NULL, G_CALLBACK(openVideoConfig)},
|
{"VideoConfigAction", "video-display", "_Video Config", NULL, NULL, G_CALLBACK(openVideoConfig)},
|
||||||
{"PaletteConfigAction", GTK_STOCK_SELECT_COLOR, "_Palette Config", NULL, NULL, G_CALLBACK(openPaletteConfig)},
|
{"PaletteConfigAction", GTK_STOCK_SELECT_COLOR, "_Palette Config", NULL, NULL, G_CALLBACK(openPaletteConfig)},
|
||||||
|
|
Loading…
Reference in New Issue