added utility tools ui

This commit is contained in:
karthikmv 2022-08-23 13:05:44 +05:30
parent 4840085269
commit 7b80e543ec
11 changed files with 282 additions and 33 deletions

View File

@ -46,8 +46,8 @@ FILE6 = iPDC.desktop
CC = gcc
LIBS = -lpthread
LDLIBS=`pkg-config --cflags --libs gtk+-3.0`
CFLAGS=-g -fcommon `pkg-config --cflags --libs gtk+-3.0`
LDLIBS=`pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0`
CFLAGS=-g -fcommon `pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0`
SOURCES = \
ipdc.c \

View File

@ -415,23 +415,6 @@ sends data frames.</property>
<property name="y">560</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="text_view">
<property name="width-request">475</property>
<property name="height-request">375</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">iPDC - A Free Phasor Data Concentrator.
Supportive IEEE C37.118 Synchrophasor std.</property>
<property name="editable">False</property>
<property name="justification">fill</property>
</object>
<packing>
<property name="x">320</property>
<property name="y">165</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="text_view1">
<property name="width-request">800</property>
@ -490,7 +473,9 @@ Supportive IEEE C37.118 Synchrophasor std.</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-top">8</property>
<property name="orientation">vertical</property>
<property name="row-spacing">9</property>
<property name="row-homogeneous">True</property>
<child>
<object class="GtkButton" id="add_pmu_button">
<property name="label" translatable="yes">Add a Source Device</property>
@ -509,7 +494,7 @@ and data frames would be received.</property>
</packing>
</child>
<child>
<object class="GtkButton" id="utiliy_tools">
<object class="GtkButton" id="utility_tools">
<property name="label" translatable="yes">Utility tools</property>
<property name="width-request">284</property>
<property name="height-request">35</property>
@ -647,6 +632,31 @@ which data frames are being received.</property>
<property name="y">163</property>
</packing>
</child>
<child>
<object class="GtkAlignment">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkTextView" id="text_view">
<property name="width-request">475</property>
<property name="height-request">375</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">iPDC - A Free Phasor Data Concentrator.
Supportive IEEE C37.118 Synchrophasor std.</property>
<property name="editable">False</property>
<property name="justification">fill</property>
</object>
</child>
</object>
<packing>
<property name="x">320</property>
<property name="y">165</property>
</packing>
</child>
</object>
</child>
</object>

View File

@ -261,7 +261,7 @@ int main(int argc, char **argv)
/* Signals Definitions*/
g_signal_connect (data->add_pmu_button, "clicked", G_CALLBACK(add_pmu), NULL);
g_signal_connect (data->menu_add_source, "activate", G_CALLBACK(add_pmu), NULL);
g_signal_connect(data->utility_tools, "activate", G_CALLBACK(utility_tools), NULL);
g_signal_connect(data->utility_tools, "clicked", G_CALLBACK(utility_tools), NULL);
g_signal_connect (data->remove_pmu_button, "clicked", G_CALLBACK(cmd_or_remove_pmu), (gpointer) "1");
g_signal_connect (data->menu_remove_source, "activate", G_CALLBACK(cmd_or_remove_pmu), (gpointer) "1");

View File

@ -37,6 +37,9 @@
#include <cairo/cairo.h>
#include <glib/gprintf.h>
#include <ctype.h>
#include <osm-gps-map.h>
#include "ipdcGui.h"
#include "global.h"
#include "connections.h"

View File

@ -1,18 +1,15 @@
#include<gtk/gtk.h>
#include<stdio.h>
void utility_tools()
void utility_tools(GtkButton *but, gpointer udata)
{
GtkWidget *new_window;
new_window = gtk_dialog_new();
new_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(new_window), "Utility Tools");
gtk_window_set_default_size(GTK_WINDOW(new_window), 600, 400);
gtk_window_set_position(GTK_WINDOW(new_window), GTK_WIN_POS_CENTER);
gtk_container_set_border_width(GTK_CONTAINER(new_window), 10);
g_signal_connect (new_window, "destroy", G_CALLBACK(gtk_widget_destroy), new_window);
//gtk_window_fullscreen(GTK_WINDOW(new_window));
// gtk_window_set_default_size(GTK_WINDOW(new_window), 800, 600);
// gtk_window_set_resizable(GTK_WINDOW(new_window), FALSE);
// gtk_window_set_position(GTK_WINDOW(new_window), GTK_WIN_POS_CENTER);
// /* Set the Title of Main Window */
// gtk_window_set_title (GTK_WINDOW (new_window), "iPDC utility tools");
// g_signal_connect (new_window, "destroy", G_CALLBACK(gtk_widget_destroy), new_window);
gtk_widget_show(new_window);
gtk_widget_show_all(new_window);
}

View File

@ -1,2 +1,2 @@
#include<gtk/gtk.h>
void utility_tools();
void utility_tools(GtkButton *but, gpointer udata);

161
iPDC/utility_tools.ui Normal file
View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow">
<property name="can-focus">False</property>
<child>
<object class="GtkMenuBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_File</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-new</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-open</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-save-as</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-cut</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-paste</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_View</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

5
iPDC/utility_tools.ui~ Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
</interface>

View File

@ -0,0 +1,43 @@
#include <gtk/gtk.h>
#include "osm-gps-map.h"
int
main (int argc,
char *argv[])
{
OsmGpsMap *map;
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Window");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", OSM_GPS_MAP_SOURCE_OPENSTREETMAP,
"tile-cache", "/tmp/",
NULL);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(map));
OsmGpsMapTrack* track = osm_gps_map_track_new();
OsmGpsMapPoint* p1, *p2;
p1 = osm_gps_map_point_new_radians(1.25663706, -0.488692191);
p2 = osm_gps_map_point_new_radians(1.06465084, -0.750491578);
osm_gps_map_track_add_point(track, p1);
osm_gps_map_track_add_point(track, p2);
g_object_set(track, "editable", TRUE, NULL);
osm_gps_map_track_add(map, track);
gtk_widget_show (GTK_WIDGET(map));
gtk_widget_show (window);
gtk_main ();
return 0;
}

BIN
test-examples/osm-gps-map Executable file

Binary file not shown.

View File

@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gthread.h>
#include <cairo/cairo.h>
#include <glib/gprintf.h>
#include <osm-gps-map.h>
int main (int argc, char **argv)
{
g_thread_init(NULL);
gtk_init (&argc, &argv);
OsmGpsMapSource_t source = OSM_GPS_MAP_SOURCE_OPENSTREETMAP;
if ( !osm_gps_map_source_is_valid(source) )
return 1;
GtkWidget *map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", source,
"tile-cache", "/tmp/",
NULL);
GtkWidget *w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_add (GTK_CONTAINER(w), map);
gtk_widget_show_all (w);
gtk_main ();
return 0;
}