add menu item stream - new generator

This commit is contained in:
c0ntrol
2016-05-15 16:38:19 +02:00
parent fc2ab97152
commit 6bcb8b2599
3 changed files with 714 additions and 10 deletions

View File

@@ -1159,6 +1159,581 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="generator_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">GVeejay Reloaded - New input stream</property>
<property name="default_width">400</property>
<property name="default_height">400</property>
<property name="icon">icon_stream.png</property>
<signal name="delete_event" handler="on_generator_window_delete_event" />
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkScrolledWindow" id="generators_files_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<widget class="GtkTreeView" id="generators">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="reorderable">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table69">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_columns">4</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkButton" id="generators_close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Close this window</property>
<signal name="clicked" handler="on_generators_close_clicked" />
<child>
<widget class="GtkAlignment" id="alignment365">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox654">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image524">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-close</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label610">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Close</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Generators&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="gveejay_window"> <widget class="GtkWindow" id="gveejay_window">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title" translatable="yes">Reloaded</property> <property name="title" translatable="yes">Reloaded</property>
@@ -1264,6 +1839,16 @@
<signal name="activate" handler="on_new_colorstream_clicked" /> <signal name="activate" handler="on_new_colorstream_clicked" />
</widget> </widget>
</child> </child>
<child>
<widget class="GtkImageMenuItem" id="new_generator">
<property name="label">_New Generator</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_generatornew_clicked" />
</widget>
</child>
<child> <child>
<widget class="GtkImageMenuItem" id="delete2"> <widget class="GtkImageMenuItem" id="delete2">
<property name="label">_Delete</property> <property name="label">_Delete</property>
@@ -15393,6 +15978,24 @@ YUV (current)</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child> <child>
<widget class="GtkButton" id="inputstream_close"> <widget class="GtkButton" id="inputstream_close">
<property name="visible">True</property> <property name="visible">True</property>

View File

@@ -1494,14 +1494,6 @@ void on_new_shm_stream_clicked(GtkWidget *wid, gpointer data)
gveejay_new_slot(MODE_STREAM); gveejay_new_slot(MODE_STREAM);
} }
void on_new_generator_stream_clicked(GtkWidget *wid, gpointer data)
{
// generator_text_args optionals args
// tree_generators get selected row
// VIMS_STREAM_NEW_GENERATOR
veejay_msg(0, "implemented me");
}
void on_shm_3490_clicked(GtkWidget *w, gpointer data) void on_shm_3490_clicked(GtkWidget *w, gpointer data)
{ {
multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 3490 ); multi_vims( VIMS_STREAM_NEW_SHARED, "%d", 3490 );
@@ -2979,12 +2971,25 @@ void on_streamnew_clicked(GtkWidget *widget, gpointer user_data)
} }
void on_generatornew_clicked(GtkWidget *widget, gpointer user_data)
{
GtkWidget *w = glade_xml_get_widget(info->main_window, "generator_window");
scan_generators( "generators" );
gtk_widget_show(w);
}
void on_inputstream_close_clicked(GtkWidget *w, gpointer user_data) void on_inputstream_close_clicked(GtkWidget *w, gpointer user_data)
{ {
GtkWidget *wid = glade_xml_get_widget(info->main_window, "inputstream_window"); GtkWidget *wid = glade_xml_get_widget(info->main_window, "inputstream_window");
gtk_widget_hide(wid); gtk_widget_hide(wid);
} }
void on_generators_close_clicked(GtkWidget *w, gpointer user_data)
{
GtkWidget *wid = glade_xml_get_widget(info->main_window, "generator_window");
gtk_widget_hide(wid);
}
void on_button_sdlclose_clicked(GtkWidget *w, gpointer user_data) void on_button_sdlclose_clicked(GtkWidget *w, gpointer user_data)
{ {
multi_vims( VIMS_RESIZE_SDL_SCREEN, "%d %d %d %d", multi_vims( VIMS_RESIZE_SDL_SCREEN, "%d %d %d %d",
@@ -3156,6 +3161,12 @@ void on_inputstream_window_delete_event(GtkWidget *w, gpointer user_data)
gtk_widget_hide(vs); gtk_widget_hide(vs);
} }
void on_generator_window_delete_event(GtkWidget *w, gpointer user_data)
{
GtkWidget *vs = glade_xml_get_widget(info->main_window, "generator_window");
gtk_widget_hide(vs);
}
void on_calibration_window_delete_event(GtkWidget *w,gpointer data) void on_calibration_window_delete_event(GtkWidget *w,gpointer data)
{ {
GtkWidget *win = glade_xml_get_widget(info->main_window, "calibration_window"); GtkWidget *win = glade_xml_get_widget(info->main_window, "calibration_window");

View File

@@ -1025,6 +1025,63 @@ static void scan_devices( const char *name)
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), model ); gtk_tree_view_set_model(GTK_TREE_VIEW(tree), model );
} }
static void scan_generators( const char *name)
{
GtkWidget *tree = glade_xml_get_widget_(info->main_window,name);
GtkListStore *store;
GtkTreeIter iter;
reset_tree(name);
gint len = 0;
single_vims( VIMS_GET_GENERATORS );
gchar *text = recv_vims(5,&len);
if(len <= 0|| !text )
{
veejay_msg(VEEJAY_MSG_WARNING, "No generators found on veejay server");
return;
}
GtkTreeModel *model = gtk_tree_view_get_model
(GTK_TREE_VIEW(tree));
store = GTK_LIST_STORE(model);
gint offset =0;
gint i = 0;
gchar *ptr = text + offset;
while( offset < len )
{
char tmp[4];
gchar *name = NULL;
gint name_len=0;
strncpy(tmp,ptr+offset,3);
tmp[3] = '\0';
offset += 3;
name_len = atoi( tmp );
if(name_len <= 0 )
{
veejay_msg(VEEJAY_MSG_ERROR, "Reading name of generator: '%s'",ptr+offset );
return;
}
name = strndup( ptr + offset, name_len );
offset += name_len;
gchar *thename = _utf8str( name );
gtk_list_store_append( store, &iter);
gtk_list_store_set(store, &iter,0,thename,-1);
g_free(thename);
free(name);
i ++;
}
free(text);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), model );
}
static void set_tooltip_by_widget(GtkWidget *w, const char *text) static void set_tooltip_by_widget(GtkWidget *w, const char *text)
{ {
gtk_widget_set_tooltip_text( w,text ); gtk_widget_set_tooltip_text( w,text );
@@ -3712,6 +3769,40 @@ void server_files_selection_func (GtkTreeView *treeview,
} }
} }
void generators_selection_func(GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *col,
gpointer user_data)
{
GtkTreeModel *model;
GtkTreeIter iter;
model = gtk_tree_view_get_model(treeview);
if(gtk_tree_model_get_iter(model,&iter,path))
{
gchar *name = NULL;
gtk_tree_model_get(model, &iter, 0, &name, -1);
multi_vims(VIMS_STREAM_NEW_GENERATOR, "0 %s" , name );
vj_msg(VEEJAY_MSG_INFO, "Tried to open %s",name);
g_free(name);
gveejay_new_slot(MODE_STREAM);
}
}
static void setup_generators()
{
GtkWidget *tree = glade_xml_get_widget_( info->main_window, "generators");
GtkListStore *store = gtk_list_store_new( 1, G_TYPE_STRING );
gtk_tree_view_set_model( GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
g_object_unref( G_OBJECT( store ));
setup_tree_text_column( "generators", 0, "Filename",0 );
g_signal_connect( tree, "row-activated", (GCallback) generators_selection_func, NULL);
}
static void setup_server_files(void) static void setup_server_files(void)
{ {
GtkWidget *tree = glade_xml_get_widget_( info->main_window, "server_files"); GtkWidget *tree = glade_xml_get_widget_( info->main_window, "server_files");
@@ -3720,8 +3811,6 @@ static void setup_server_files(void)
g_object_unref( G_OBJECT( store )); g_object_unref( G_OBJECT( store ));
setup_tree_text_column( "server_files", 0, "Filename",0 ); setup_tree_text_column( "server_files", 0, "Filename",0 );
// gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
// gtk_tree_selection_set_select_function(selection, server_files_selection_func, NULL, NULL);
g_signal_connect( tree, "row-activated", (GCallback) server_files_selection_func, NULL); g_signal_connect( tree, "row-activated", (GCallback) server_files_selection_func, NULL);
} }
@@ -7420,6 +7509,7 @@ void vj_gui_init(char *glade_file,
setup_rgbkey(); setup_rgbkey();
setup_bundles(); setup_bundles();
setup_server_files(); setup_server_files();
setup_generators();
text_defaults(); text_defaults();