CfgGuiFunctions.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <netinet/in.h>
#include <gtk/gtk.h>
#include "PmuGui.h"
#include "CfgFunction.h"
#include "CfgGuiFunctions.h"
Include dependency graph for CfgGuiFunctions.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int validation_cfg_create ()
int validation_phasor_names (GtkWidget *widget, gpointer udata)
int validation_analog_names (GtkWidget *widget, gpointer udata)
int validation_digital_names (GtkWidget *widget, gpointer udata)
int validation_ph_an_num (GtkButton *but, gpointer udata)
int validation_new_phasor_names (GtkWidget *widget, gpointer udata)
int validation_new_analog_names (GtkWidget *widget, gpointer udata)
int validation_new_data_rate (GtkButton *but, gpointer udata)
int validation_remove_ph_an_num (GtkButton *but, gpointer udata)
void validation_hdr_frm (GtkWidget *widget, gpointer udata)
void cfg_create_function (GtkWidget *widget, gpointer udata)
void channel_names_for_phasor ()
void channel_names_for_analog ()
void channel_names_for_digital ()
void final_cfg_create ()
void cfg_chng_options (GtkWidget *widget, gpointer udata)
void cfg_STAT_change (GtkWidget *widget, gpointer udata)
void Change_pmu_configuration (GtkWidget *widget, gpointer udata)
void new_phasor_num (GtkWidget *widget, gpointer udata)
void new_analog_num ()
void new_channel_names_for_phasor ()
void new_channel_names_for_analog ()
void change_data_rate_option ()
void enter_new_data_rate (GtkWidget *widget, gpointer udata)
void remove_phasor_num (GtkWidget *widget, gpointer udata)
void remove_analog_num ()
int final_cfg_update_call (GtkButton *but, gpointer udata)
void hdr_create_function (GtkWidget *widget, gpointer udata)

Function Documentation

void cfg_chng_options ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1196 of file CfgGuiFunctions.c.

References CCOptionWin, cfg_STAT_change(), Change_pmu_configuration(), and markup.

Referenced by main().

01197         {
01198                 /* local variables */
01199                 GtkWidget *table, *label;
01200                 GtkWidget *ID_butn, *PE_butn, *DS_butn;
01201                 GtkWidget *PT_butn, *CC_butn, *close_butn;
01202 
01203                 /* Create a new dialog window for the Configration Modification */ 
01204                 CCOptionWin = gtk_dialog_new ();
01205                 gtk_window_set_title (GTK_WINDOW (CCOptionWin), "Configration Modification");
01206                 gtk_container_set_border_width (GTK_CONTAINER (CCOptionWin), 10);
01207                 gtk_widget_set_size_request (CCOptionWin, 400, 430);
01208                  
01209                 /* Create a table of 7 by 3 squares */
01210                 table = gtk_table_new (9, 3, FALSE);
01211             
01212                 /* Set the spacing to 15 on x and 60 on y */
01213                 gtk_table_set_row_spacings (GTK_TABLE (table), 15);
01214                 gtk_table_set_col_spacings (GTK_TABLE (table), 60);
01215             
01216                 /* Pack the table into the window */
01217                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCOptionWin)->vbox), table, TRUE, TRUE, 0);
01218                 gtk_widget_show (table);
01219 
01220                 label = gtk_label_new (" ");
01221                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Change STAT Word</b></span>");
01222                 gtk_label_set_markup (GTK_LABEL (label), markup);
01223                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01224                 gtk_widget_show (label);
01225                 g_free (markup);
01226  
01227                 ID_butn = gtk_button_new_with_label ("Set Invalid Data bit");
01228                 gtk_table_attach_defaults (GTK_TABLE (table), ID_butn, 1, 2, 2, 3);
01229                 gtk_widget_show (ID_butn);
01230 
01231                 PE_butn = gtk_button_new_with_label ("Set PMU Error bit");
01232                 gtk_table_attach_defaults (GTK_TABLE (table), PE_butn, 1, 2, 3, 4);
01233                 gtk_widget_show (PE_butn);
01234                 
01235                 DS_butn = gtk_button_new_with_label ("Set Data Sorting bit");
01236                 gtk_table_attach_defaults (GTK_TABLE (table), DS_butn, 1, 2, 4, 5);
01237                 gtk_widget_show (DS_butn);
01238  
01239                 PT_butn = gtk_button_new_with_label ("Set PMU Trigger bit");
01240                 gtk_table_attach_defaults (GTK_TABLE (table), PT_butn, 1, 2, 5, 6);
01241                 gtk_widget_show (PT_butn);
01242 
01243                 CC_butn = gtk_button_new_with_label ("Set Configuration Change bit");
01244                 gtk_table_attach_defaults (GTK_TABLE (table), CC_butn, 1, 2, 6, 7);
01245                 gtk_widget_show (CC_butn);
01246                 
01247                 label = gtk_label_new (" ");
01248                 markup = g_markup_printf_escaped ("<span foreground=\"#333333\" font='8'><b>Note : The Synchronization error handle internaly.</b></span>");
01249                 gtk_label_set_markup (GTK_LABEL (label), markup);
01250                 gtk_table_attach_defaults (GTK_TABLE (table), label,  1, 2, 8, 9);
01251                 gtk_widget_show (label);
01252                 g_free (markup);
01253 
01254                 /* Add a "close" button to the bottom of the dialog */
01255                 close_butn = gtk_button_new_with_label ("close");
01256 
01257                 /* Signal handling for all buttons on Window */
01258                 g_signal_connect (CC_butn, "clicked", G_CALLBACK (Change_pmu_configuration), NULL);
01259                 g_signal_connect (ID_butn, "clicked", G_CALLBACK (cfg_STAT_change), (gpointer) "a");
01260                 g_signal_connect (PE_butn, "clicked", G_CALLBACK (cfg_STAT_change), (gpointer) "b");
01261                 g_signal_connect (DS_butn, "clicked", G_CALLBACK (cfg_STAT_change), (gpointer) "c");
01262                 g_signal_connect (PT_butn, "clicked", G_CALLBACK (cfg_STAT_change), (gpointer) "d");
01263                 g_signal_connect_swapped (close_butn, "clicked", G_CALLBACK (gtk_widget_destroy), CCOptionWin);
01264                 g_signal_connect_swapped (CCOptionWin, "response", G_CALLBACK (gtk_widget_destroy), CCOptionWin);
01265 
01266                 /* This makes it so the button is the default */
01267                 gtk_widget_set_can_default (close_butn, TRUE);
01268                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCOptionWin)->action_area), close_butn, TRUE, TRUE, 0);
01269             
01270                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01271                 gtk_widget_grab_default (close_butn);
01272                 gtk_widget_show (close_butn);
01273 
01274                 /* Finally show the CCOptionWin */
01275                 gtk_widget_show (CCOptionWin);
01276         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void cfg_create_function ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 715 of file CfgGuiFunctions.c.

References cfg_setup_window, markup, p_af, p_anNumber, p_dgNumber, p_drate, p_ff, p_id, p_pf, p_phNumber, p_pn, p_stn, Pmu_Help(), and validation_cfg_create().

Referenced by main().

00716         {
00717                 /* local variables */
00718                 GtkWidget *table, *label;
00719                 GtkWidget *valdbutton, *help_button;
00720                         
00721                 /* Create a new dialog window for the PMU Configuration Setup window */
00722                 cfg_setup_window = gtk_dialog_new ();
00723                 g_signal_connect (cfg_setup_window, "destroy", G_CALLBACK (gtk_widget_destroy), cfg_setup_window);
00724                 gtk_window_set_title (GTK_WINDOW (cfg_setup_window), "PMU Configuration Setup");
00725                 gtk_container_set_border_width (GTK_CONTAINER (cfg_setup_window), 10);
00726                 gtk_widget_set_size_request (cfg_setup_window, 350, 480);
00727                  
00728                 /* Create a table of 11 by 2 squares. */
00729                 table = gtk_table_new (11, 2, FALSE);
00730             
00731                 /* Set the spacing to 10 on x and 25 on y */
00732                 gtk_table_set_row_spacings (GTK_TABLE (table), 10);
00733                 gtk_table_set_col_spacings (GTK_TABLE (table), 25);
00734             
00735                 /* Pack the table into the window */
00736                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(cfg_setup_window)->vbox), table, TRUE, TRUE, 0);
00737                 gtk_widget_show (table);
00738 
00739                 /* Add few buttons to the bottom of the dialog */
00740                 valdbutton = gtk_button_new_with_label ("Next");
00741                 help_button = gtk_button_new_with_label ("Help");
00742             
00743                 /* This simply creates a grid of toggle buttons on the table */
00744                 label = gtk_label_new (" ");
00745                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter PMU Configuration Details</b></span>");
00746                 gtk_label_set_markup (GTK_LABEL (label), markup);
00747                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
00748                 gtk_widget_show (label);
00749                 g_free (markup);
00750          
00751                 label = gtk_label_new ("PMU ID                 ");
00752                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
00753                 gtk_widget_show (label);
00754  
00755                 label = gtk_label_new ("Station Name         ");
00756                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
00757                 gtk_widget_show (label);
00758 
00759                 label = gtk_label_new ("Frequency Format  ");
00760                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
00761                 gtk_widget_show (label);
00762 
00763                 label = gtk_label_new ("Analog Format         ");
00764                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5);
00765                 gtk_widget_show (label);
00766          
00767                 label = gtk_label_new ("Phasor Format         ");
00768                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6);
00769                 gtk_widget_show (label);
00770 
00771                 label = gtk_label_new ("Phasor Notation       ");
00772                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 6, 7);
00773                 gtk_widget_show (label);
00774 
00775                 label = gtk_label_new ("Number of Phasors    ");
00776                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 7, 8);
00777                 gtk_widget_show (label);
00778 
00779                 label = gtk_label_new ("Number of Analog     ");
00780                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 8, 9);
00781                 gtk_widget_show (label);
00782 
00783                 label = gtk_label_new ("Digital Status Word   ");
00784                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 9, 10);
00785                 gtk_widget_show (label);
00786 
00787                 label = gtk_label_new ("Data Rate               ");
00788                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 10, 11);
00789                 gtk_widget_show (label);
00790 
00791                 /* Create text boxes for user to enter appropriate values */
00792                 p_id = gtk_entry_new();
00793                 gtk_entry_set_max_length ((GtkEntry *)p_id, 5);
00794                 gtk_table_attach_defaults (GTK_TABLE (table), p_id, 1, 2, 1, 2);
00795                 gtk_widget_show (p_id);
00796          
00797                 /* Create combo boxe for user with some fixed values */
00798                 p_stn = gtk_entry_new();
00799                 gtk_entry_set_max_length ((GtkEntry *)p_stn, 16);
00800                 gtk_table_attach_defaults (GTK_TABLE (table), p_stn, 1, 2, 2, 3);
00801                 gtk_widget_show (p_stn);
00802 
00803                 p_ff = gtk_combo_box_new_text();
00804                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_ff), "Fix Point");
00805                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_ff), "Floating Point");
00806                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_ff), 0);
00807                 gtk_table_attach_defaults (GTK_TABLE (table), p_ff, 1, 2, 3, 4);
00808                 gtk_widget_show (p_ff);
00809                         
00810                 p_af = gtk_combo_box_new_text();
00811                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_af), "Fix Point");
00812                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_af), "Floating Point");
00813                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_af), 0);
00814                 gtk_table_attach_defaults (GTK_TABLE (table), p_af, 1, 2, 4, 5);
00815                 gtk_widget_show (p_af);
00816 
00817                 p_pf = gtk_combo_box_new_text();
00818                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_pf), "Fix Point");
00819                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_pf), "Floating Point");
00820                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_pf), 0);
00821                 gtk_table_attach_defaults (GTK_TABLE (table), p_pf, 1, 2, 5, 6);
00822                 gtk_widget_show (p_pf);
00823 
00824                 p_pn = gtk_combo_box_new_text();
00825                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_pn), "Ractangular");
00826                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_pn), "Polar");
00827                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_pn), 0);
00828                 gtk_table_attach_defaults (GTK_TABLE (table), p_pn, 1, 2, 6, 7);
00829                 gtk_widget_show (p_pn);
00830 
00831                 p_phNumber = gtk_entry_new();
00832                 gtk_entry_set_max_length ((GtkEntry *)p_phNumber, 2);
00833                 gtk_table_attach_defaults (GTK_TABLE (table), p_phNumber, 1, 2, 7, 8);
00834                 gtk_widget_show (p_phNumber);
00835 
00836                 p_anNumber = gtk_entry_new();
00837                 gtk_entry_set_max_length ((GtkEntry *)p_anNumber, 2);
00838                 gtk_table_attach_defaults (GTK_TABLE (table), p_anNumber, 1, 2, 8, 9);
00839                 gtk_widget_show (p_anNumber);
00840 
00841                 p_dgNumber = gtk_entry_new();
00842                 gtk_entry_set_max_length ((GtkEntry *)p_dgNumber, 1);
00843                 gtk_table_attach_defaults (GTK_TABLE (table), p_dgNumber, 1, 2, 9, 10);
00844                 gtk_widget_show (p_dgNumber);
00845 
00846                 p_drate = gtk_combo_box_new_text();
00847                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "10");
00848                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "25");
00849                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "50");
00850                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "60");
00851                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_drate), 0);
00852                 gtk_table_attach_defaults (GTK_TABLE (table), p_drate, 1, 2, 10, 11);
00853                 gtk_widget_show (p_drate);
00854 
00855                 /* Signal handling for buttons on CFG Setuo Window */
00856                 g_signal_connect_swapped (valdbutton, "clicked", G_CALLBACK (validation_cfg_create), valdbutton);
00857                 g_signal_connect_swapped (help_button, "clicked", G_CALLBACK (Pmu_Help), NULL);
00858                 g_signal_connect_swapped (cfg_setup_window, "destroy", G_CALLBACK (gtk_widget_destroy), cfg_setup_window);
00859                     
00860                 /* This makes it so the button is the default. */
00861                 gtk_widget_set_can_default (valdbutton, TRUE);
00862                 gtk_widget_set_can_default (help_button, TRUE);
00863                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cfg_setup_window)->action_area), valdbutton, TRUE, TRUE, 0);
00864                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cfg_setup_window)->action_area), help_button, TRUE, TRUE, 0);
00865                     
00866                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
00867                 gtk_widget_grab_default (valdbutton);
00868                 gtk_widget_show (valdbutton);
00869                 gtk_widget_grab_default (help_button);
00870                 gtk_widget_show (help_button);
00871 
00872                 /* Finally show the cfg_setup_window */
00873                 gtk_widget_show (cfg_setup_window);
00874         };

Here is the call graph for this function:

Here is the caller graph for this function:

void cfg_STAT_change ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1284 of file CfgGuiFunctions.c.

References CCOptionWin, and validation_result().

Referenced by cfg_chng_options().

01285         {
01286                 /* local variables */
01287                 char find_butn[2];
01288                 static const char filename_1[] = "change.bin";
01289                 FILE *file_1;
01290 
01291                 /* For identifing singnal came from which button? */
01292                 strcpy(find_butn,(char *) udata);
01293 
01294                 if(!strcmp(find_butn, "a"))
01295                 {
01296                         file_1 = fopen (filename_1,"w");
01297                         {   
01298                                 fprintf(file_1, "%s", "1");
01299                         }
01300                         fclose (file_1);
01301                         validation_result("\nSTAT CHANGED\n\nBit 15 of Stat word has been set to 1 for Invalid Data.\t\n");     /* Show the success message to user */
01302                 }
01303                 else if(!strcmp(find_butn, "b"))
01304                 {
01305                         file_1 = fopen (filename_1,"w");
01306                         {   
01307                                 fprintf(file_1, "%s", "2");
01308                         }
01309                         fclose (file_1);
01310                         validation_result("\nSTAT CHANGED\n\n\nBit 14 of Stat word has been set to 1 for PMU Error.\n");        /* Show the success message to user */
01311                 }
01312                 else if(!strcmp(find_butn, "c"))
01313                 {
01314                         file_1 = fopen (filename_1,"w");
01315                         {   
01316                                 fprintf(file_1, "%s", "3");
01317                         }
01318                         fclose (file_1);
01319                         validation_result("\nSTAT CHANGED\n\n\nBit 12 of Stat word has been set to 1 for Data Sorting.\n");     /* Show the success message to user */
01320                 }
01321                 else if(!strcmp(find_butn, "d"))
01322                 {
01323                         file_1 = fopen (filename_1,"w");
01324                         {   
01325                                 fprintf(file_1, "%s", "4");
01326                         }
01327                         fclose (file_1);
01328                         validation_result("\nSTAT CHANGED\n\n\nBit 11 of Stat word has been set to 1 for PMU Trigger Detected.\n");     /* Show the success message to user */
01329                 }
01330 
01331                 /* Close/destroy the CCOptionWin */
01332                 gtk_widget_destroy(CCOptionWin);                                
01333         };

Here is the call graph for this function:

Here is the caller graph for this function:

void change_data_rate_option (  ) 

Definition at line 1751 of file CfgGuiFunctions.c.

References CCWin, enter_new_data_rate(), final_cfg_update_call(), and markup.

Referenced by new_channel_names_for_analog(), validation_new_analog_names(), and validation_remove_ph_an_num().

01752         {
01753                 /* local variables */
01754                 GtkWidget *table;
01755                 GtkWidget *Addbutton, *Removebutton;
01756                 GtkWidget *close_butn, *label;
01757 
01758                 /* Create a new dialog window for PMU Data Rate */ 
01759                 CCWin = gtk_dialog_new ();
01760                 gtk_window_set_title (GTK_WINDOW (CCWin), "PMU Data Rate ");
01761                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01762                 gtk_widget_set_size_request (CCWin, 350, 350);
01763                  
01764                 /* Create a table of 4 by 2 squares. */
01765                 table = gtk_table_new (4, 2, FALSE);
01766             
01767                 /* Set the spacing to 15 on x and 25 on y */
01768                 gtk_table_set_row_spacings (GTK_TABLE (table), 15);
01769                 gtk_table_set_col_spacings (GTK_TABLE (table), 25);
01770             
01771                 /* Pack the table into the window */
01772                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01773                 gtk_widget_show (table);
01774 
01775                 label = gtk_label_new (" ");
01776                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Data Rate Options</b></span>");
01777                 gtk_label_set_markup (GTK_LABEL (label), markup);
01778                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01779                 gtk_widget_show (label);
01780                 g_free (markup);
01781  
01782                 /* Add two radio buttons on the dialog window */
01783                 Addbutton = gtk_radio_button_new_with_label (NULL, "YES");
01784                 gtk_table_attach_defaults (GTK_TABLE (table), Addbutton, 0, 1, 2, 3);
01785                 gtk_widget_show (Addbutton);
01786 
01787                 Removebutton = gtk_radio_button_new_with_label (NULL, "NO");
01788                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (Removebutton), TRUE);
01789                 gtk_table_attach_defaults (GTK_TABLE (table), Removebutton, 0, 1, 3, 4);
01790                 gtk_widget_show (Removebutton);
01791 
01792                 /* Add a "close" button to the bottom of the dialog */
01793                 close_butn = gtk_button_new_with_label ("Close");
01794 
01795                 /* Signal handling for buttons on Data rate Window */
01796                 g_signal_connect_swapped (Addbutton, "clicked", G_CALLBACK (enter_new_data_rate), NULL);
01797                 g_signal_connect_swapped (Removebutton, "clicked", G_CALLBACK (final_cfg_update_call), NULL);
01798                 g_signal_connect_swapped (close_butn, "clicked", G_CALLBACK (gtk_widget_destroy), CCWin);
01799                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01800 
01801                 /* This makes it so the button is the default */
01802                 gtk_widget_set_can_default (close_butn, TRUE);
01803                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), close_butn, TRUE, TRUE, 0);
01804             
01805                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01806                 gtk_widget_grab_default (close_butn);
01807                 gtk_widget_show (close_butn);
01808 
01809                 /* Finally show the CCWin */
01810                 gtk_widget_show (CCWin);
01811         };

Here is the call graph for this function:

Here is the caller graph for this function:

void Change_pmu_configuration ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1342 of file CfgGuiFunctions.c.

References CCOptionWin, CCWin, markup, new_phasor_num(), and remove_phasor_num().

Referenced by cfg_chng_options().

01343         {
01344                 /* local variables */
01345                 GtkWidget *table;
01346                 GtkWidget *close_butn, *label;
01347                 GtkWidget *Addbutton, *Removebutton;
01348 
01349                 /* Create a new dialog window for the Option Window */ 
01350                 gtk_widget_destroy(CCOptionWin);                                
01351                 CCWin = gtk_dialog_new ();
01352                 gtk_window_set_title (GTK_WINDOW (CCWin), "Option Window");
01353                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01354                 gtk_widget_set_size_request (CCWin, 350, 350);
01355                  
01356                 /* Create a table of 4 by 2 squares */
01357                 table = gtk_table_new (4, 2, FALSE);
01358             
01359                 /* Set the spacing to 15 on x and 25 on y */
01360                 gtk_table_set_row_spacings (GTK_TABLE (table), 15);
01361                 gtk_table_set_col_spacings (GTK_TABLE (table), 25);
01362             
01363                 /* Pack the table into the window */
01364                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01365                 gtk_widget_show (table);
01366 
01367                 label = gtk_label_new (" ");
01368                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Select Appropriate Option</b></span>");
01369                 gtk_label_set_markup (GTK_LABEL (label), markup);
01370                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01371                 gtk_widget_show (label);
01372                 g_free (markup);
01373  
01374                 /* Add few radio buttons on the dialog window */
01375                 Addbutton = gtk_radio_button_new_with_label (NULL, "Add New Channels");
01376                 gtk_table_attach_defaults (GTK_TABLE (table), Addbutton, 0, 1, 2, 3);
01377                 gtk_widget_show (Addbutton);
01378 
01379                 Removebutton = gtk_radio_button_new_with_label (NULL, "Remove Channels");
01380                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (Removebutton), TRUE);
01381                 gtk_table_attach_defaults (GTK_TABLE (table), Removebutton, 0, 1, 3, 4);
01382                 gtk_widget_show (Removebutton);
01383                 
01384                 /* Add 'Close' buttons on the dialog window */
01385                 close_butn = gtk_button_new_with_label ("Close");
01386 
01387                 /* Signal handling for buttons on Option Window */
01388                 g_signal_connect_swapped (Addbutton, "clicked", G_CALLBACK (new_phasor_num), NULL);
01389                 g_signal_connect_swapped (Removebutton, "clicked", G_CALLBACK (remove_phasor_num), NULL);
01390                 g_signal_connect_swapped (close_butn, "clicked", G_CALLBACK (gtk_widget_destroy), CCWin);
01391                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01392 
01393                 /* This makes it so the button is the default. */
01394                 gtk_widget_set_can_default (close_butn, TRUE);
01395                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), close_butn, TRUE, TRUE, 0);
01396             
01397                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01398                 gtk_widget_grab_default (close_butn);
01399                 gtk_widget_show (close_butn);
01400 
01401                 /* Finally show the CCWin */
01402                 gtk_widget_show (CCWin);
01403         };

Here is the call graph for this function:

Here is the caller graph for this function:

void channel_names_for_analog (  ) 

Definition at line 969 of file CfgGuiFunctions.c.

References AnalogChWin, ConfigurationFrame::cfg_annmr_val, cfg_info, channel_names_for_digital(), i, markup, num_text, and validation_analog_names().

Referenced by validation_phasor_names().

00970         {
00971                 /* Analog is not Mandatory component in CFG, it could be zero */
00972                 if (cfg_info->cfg_annmr_val == 0)
00973                 {
00974                         /* Next call to digital channel names */
00975                         channel_names_for_digital ();
00976                 }
00977                 else    /* if ANNMR > 0 */
00978                 {
00979                         /* local variables */
00980                         int i;
00981                         char line[30];
00982                         GtkWidget *table, *scrolled_window;
00983                         GtkWidget *label, *next_button;
00984           
00985                         /* Create a new dialog window for the scrolled window to be packed into */                              
00986                         AnalogChWin = gtk_dialog_new ();
00987                         g_signal_connect (AnalogChWin, "destroy", G_CALLBACK (gtk_widget_destroy), AnalogChWin);
00988                         gtk_window_set_title (GTK_WINDOW (AnalogChWin), "Analog Channels");
00989                         gtk_container_set_border_width (GTK_CONTAINER (AnalogChWin), 10);
00990                         gtk_widget_set_size_request (AnalogChWin, 400, 350);
00991                  
00992                         /* Create a new scrolled window */
00993                         scrolled_window = gtk_scrolled_window_new (NULL, NULL);
00994                         gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
00995 
00996                         /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. GTK_POLICY_AUTOMATIC will automatically decide whether you need scrollbars,
00997                            whereas GTK_POLICY_ALWAYS will always leave the scrollbars there. The first one is the horizontal scrollbar, the second is vertical. */
00998                         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
00999 
01000                         /* The dialog window is created with a vbox packed into it */                                                           
01001                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG(AnalogChWin)->vbox), scrolled_window, TRUE, TRUE, 0);
01002                         gtk_widget_show (scrolled_window);
01003 
01004                         /* Create a table of ? by 2 squares */
01005                         table = gtk_table_new (cfg_info->cfg_annmr_val+1, 2, FALSE);
01006             
01007                         label = gtk_label_new (" ");
01008                         markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='10'><b>Enter Analog Channels Name</b></span>");
01009                         gtk_label_set_markup (GTK_LABEL (label), markup);
01010                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01011                         gtk_widget_show (label);
01012                         g_free (markup);
01013 
01014                         /* Set the spacing to 15 on x and 25 on y */
01015                         gtk_table_set_row_spacings (GTK_TABLE (table), 15);
01016                         gtk_table_set_col_spacings (GTK_TABLE (table), 25);
01017             
01018                         /* Pack the table into the window */
01019                         gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
01020                         gtk_widget_show (table);
01021 
01022                         /* Add a "Next" button to the bottom of the dialog */
01023                         next_button = gtk_button_new_with_label ("Next");
01024             
01025                         /* This simply creates a grid of Lables with text on the table to demonstrate the scrolled window. */
01026                         for(i=1; i<cfg_info->cfg_annmr_val+1; i++)
01027                         {
01028                                 memset(line,'\0',sizeof(line));
01029                                 sprintf(line, "Analog Channel %d : ", i);
01030                                 label = gtk_label_new (line);
01031                                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i+1);
01032                                 gtk_widget_show (label);
01033                         }
01034 
01035                         for(i=1; i<cfg_info->cfg_annmr_val+1; i++)
01036                         {
01037                                 num_text[i] = gtk_entry_new ();
01038                                 gtk_entry_set_max_length ((GtkEntry *)num_text[i], 16);
01039                                 gtk_table_attach_defaults (GTK_TABLE (table), num_text[i], 1, 2, i, i+1);
01040                                 gtk_widget_show (num_text[i]);
01041                         }
01042 
01043                         /* Signal handling for Next button on Window */
01044                         g_signal_connect_swapped (next_button, "clicked", G_CALLBACK (validation_analog_names), NULL);
01045             
01046                         /* This makes it so the button is the default. */
01047                         gtk_widget_set_can_default (next_button, TRUE);
01048                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (AnalogChWin)->action_area), next_button, TRUE, TRUE, 0);
01049             
01050                         /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01051                         gtk_widget_grab_default (next_button);
01052                         gtk_widget_show (next_button);
01053 
01054                         /* Finally show the AnalogChWin */
01055                         gtk_widget_show (AnalogChWin);
01056                 }
01057         };

Here is the call graph for this function:

Here is the caller graph for this function:

void channel_names_for_digital (  ) 

Definition at line 1065 of file CfgGuiFunctions.c.

References AnalogChWin, ConfigurationFrame::cfg_dgnmr_val, cfg_info, final_cfg_create(), i, markup, num_text, and validation_digital_names().

Referenced by channel_names_for_analog(), and validation_analog_names().

01066         {
01067                 /* Analog is not Mandatory component in CFG, it could be zero */
01068                 if (cfg_info->cfg_dgnmr_val == 0)
01069                 {
01070                         /* Next call to 'final_cfg_create ()' */
01071                         final_cfg_create ();
01072                 }
01073                 else    /* if DGNMR > 0 */
01074                 {
01075                         /* local variables */
01076                         int i;
01077                         char line[30];
01078                         GtkWidget *table, *scrolled_window;
01079                         GtkWidget *label, *next_button;
01080           
01081                         /* Create a new dialog window for the scrolled window to be packed into */                              
01082                         AnalogChWin = gtk_dialog_new ();
01083                         g_signal_connect (AnalogChWin, "destroy", G_CALLBACK (gtk_widget_destroy), AnalogChWin);
01084                         gtk_window_set_title (GTK_WINDOW (AnalogChWin), "Digital Channels");
01085                         gtk_container_set_border_width (GTK_CONTAINER (AnalogChWin), 10);
01086                         gtk_widget_set_size_request (AnalogChWin, 400, 550);
01087                  
01088                         /* Create a new scrolled window */
01089                         scrolled_window = gtk_scrolled_window_new (NULL, NULL);
01090                         gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
01091 
01092                         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
01093 
01094                         /* The dialog window is created with a vbox packed into it */                                                           
01095                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG(AnalogChWin)->vbox), scrolled_window, TRUE, TRUE, 0);
01096                         gtk_widget_show (scrolled_window);
01097 
01098                         /* Create a table of ? by 2 squares. */
01099                         table = gtk_table_new (cfg_info->cfg_dgnmr_val*16+1, 2, FALSE);
01100             
01101                         /* Set the spacing to 15 on x and 25 on y */
01102                         gtk_table_set_row_spacings (GTK_TABLE (table), 15);
01103                         gtk_table_set_col_spacings (GTK_TABLE (table), 25);
01104             
01105                         /* Pack the table into the window */
01106                         gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
01107                         gtk_widget_show (table);
01108 
01109                         /* Add a "Next" button to the bottom of the dialog */
01110                         next_button = gtk_button_new_with_label ("Next");
01111             
01112                         label = gtk_label_new (" ");
01113                         markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='10'><b>Enter Digital Channels Name</b></span>");
01114                         gtk_label_set_markup (GTK_LABEL (label), markup);
01115                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01116                         gtk_widget_show (label);
01117                         g_free (markup);
01118 
01119                         /* This simply creates a grid of Lables with text on the table to demonstrate the scrolled window. */
01120                         for(i=1; i<cfg_info->cfg_dgnmr_val*16+1; i++)
01121                         {
01122                                 memset(line,'\0',sizeof(line));
01123                                 sprintf(line, "Digita Channel %d : ", i);
01124                                 label = gtk_label_new (line);
01125                                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i+1);
01126                                 gtk_widget_show (label);
01127                         }
01128 
01129                         for(i=1; i<cfg_info->cfg_dgnmr_val*16+1; i++)
01130                         {
01131                                 num_text[i] = gtk_entry_new ();
01132                                 //gtk_entry_set_max_length (GtkEntry *entry, gint max);
01133                                 gtk_entry_set_max_length ((GtkEntry *)num_text[i], 16);
01134                                 gtk_table_attach_defaults (GTK_TABLE (table), num_text[i], 1, 2, i, i+1);
01135                                 gtk_widget_show (num_text[i]);
01136                         }
01137 
01138                         /* Signal handling for Next button on Window */
01139                         g_signal_connect_swapped (next_button, "clicked", G_CALLBACK (validation_digital_names), NULL);
01140             
01141                         /* This makes it so the button is the default. */
01142                         gtk_widget_set_can_default (next_button, TRUE);
01143                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (AnalogChWin)->action_area), next_button, TRUE, TRUE, 0);
01144             
01145                         /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01146                         gtk_widget_grab_default (next_button);
01147                         gtk_widget_show (next_button);
01148 
01149                         /* Finally show the AnalogChWin */
01150                         gtk_widget_show (AnalogChWin);
01151                 }
01152         };

Here is the call graph for this function:

Here is the caller graph for this function:

void channel_names_for_phasor (  ) 

Definition at line 882 of file CfgGuiFunctions.c.

References cfg_info, ConfigurationFrame::cfg_phnmr_val, i, markup, num_text, PhasorChWin, and validation_phasor_names().

Referenced by validation_cfg_create().

00883         {
00884                 /* local variables */
00885                 int i;
00886                 char line[20];
00887                 GtkWidget *table, *scrolled_window;
00888                 GtkWidget *label, *next_button;
00889 
00890                 /* Create a new dialog window for the scrolled window to be packed into */
00891                 PhasorChWin = gtk_dialog_new ();
00892                 g_signal_connect (PhasorChWin, "destroy", G_CALLBACK (gtk_widget_destroy), PhasorChWin);
00893                 gtk_window_set_title (GTK_WINDOW (PhasorChWin), "Phasor Channels");
00894                 gtk_container_set_border_width (GTK_CONTAINER (PhasorChWin), 10);
00895                 gtk_widget_set_size_request (PhasorChWin, 400, 400);
00896          
00897                 /* Create a new scrolled window */
00898                 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
00899                 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
00900 
00901                 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. GTK_POLICY_AUTOMATIC will automatically decide whether you need scrollbars,
00902                    whereas GTK_POLICY_ALWAYS will always leave the scrollbars there. The first one is the horizontal scrollbar, the second is vertical. */
00903                 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
00904 
00905                 /* The dialog window is created with a vbox packed into it */                                                           
00906                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(PhasorChWin)->vbox), scrolled_window, TRUE, TRUE, 0);
00907                 gtk_widget_show (scrolled_window);
00908 
00909                 /* Create a table of ? by 2 squares. */
00910                 table = gtk_table_new (cfg_info->cfg_phnmr_val+1, 2, FALSE);
00911     
00912                 /* Set the spacing to 15 on x and 25 on y */
00913                 gtk_table_set_row_spacings (GTK_TABLE (table), 15);
00914                 gtk_table_set_col_spacings (GTK_TABLE (table), 25);
00915     
00916                 /* Pack the table into the window */
00917                 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
00918                 gtk_widget_show (table);
00919 
00920                 /* Add a "Next" button to the bottom of the dialog */
00921                 next_button = gtk_button_new_with_label ("Next");
00922     
00923                 label = gtk_label_new (" ");
00924                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='10'><b>Enter Phasor Channels Name</b></span>");
00925                 gtk_label_set_markup (GTK_LABEL (label), markup);
00926                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
00927                 gtk_widget_show (label);
00928                 g_free (markup);
00929 
00930                 /* This simply creates a grid of Lables with text on the table to demonstrate the scrolled window. */
00931                 for(i=1; i<cfg_info->cfg_phnmr_val+1; i++)
00932                 {
00933                         memset(line,'\0',sizeof(line));
00934                         sprintf(line, "Phasor Channel %d : ", i);
00935                         label = gtk_label_new (line);
00936                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i+1);
00937                         gtk_widget_show (label);
00938                 }
00939 
00940                 for(i=1; i<cfg_info->cfg_phnmr_val+1; i++)
00941                 {
00942                         num_text[i] = gtk_entry_new ();
00943                         gtk_entry_set_max_length ((GtkEntry *)num_text[i], 16);
00944                         gtk_table_attach_defaults (GTK_TABLE (table), num_text[i], 1, 2, i, i+1);
00945                         gtk_widget_show (num_text[i]);
00946                 }
00947 
00948                 /* Signal handling for Next button on Window */
00949                 g_signal_connect_swapped (next_button, "clicked", G_CALLBACK (validation_phasor_names), NULL);
00950     
00951                 /* This makes it so the button is the default. */
00952                 gtk_widget_set_can_default (next_button, TRUE);
00953                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (PhasorChWin)->action_area), next_button, TRUE, TRUE, 0);
00954     
00955                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
00956                 gtk_widget_grab_default (next_button);
00957                 gtk_widget_show (next_button);
00958 
00959                 /* Finally show the PhasorChWin */
00960                 gtk_widget_show (PhasorChWin);
00961         };

Here is the call graph for this function:

Here is the caller graph for this function:

void enter_new_data_rate ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1820 of file CfgGuiFunctions.c.

References CCWin, markup, p_drate, and validation_new_data_rate().

Referenced by change_data_rate_option().

01821         {
01822                 /* local variables */
01823                 GtkWidget *table;
01824                 GtkWidget *next_butn, *label;
01825 
01826                 /* Create a new dialog window for the New Data Rate */ 
01827                 gtk_widget_destroy(CCWin);                              
01828                 CCWin = gtk_dialog_new ();
01829                 gtk_window_set_title (GTK_WINDOW (CCWin), "New Data Rate");
01830                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01831                 gtk_widget_set_size_request (CCWin, 350, 300);
01832                 
01833                 /* Create a table of 3 by 3 squares */
01834                 table = gtk_table_new (3, 3, FALSE);
01835             
01836                 /* Set the spacing to 25 on x and 40 on y */
01837                 gtk_table_set_row_spacings (GTK_TABLE (table), 25);
01838                 gtk_table_set_col_spacings (GTK_TABLE (table), 40);
01839             
01840                 /* Pack the table into the window */
01841                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01842                 gtk_widget_show (table);
01843 
01844                 label = gtk_label_new (" ");
01845                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b> Enter Data Rate</b></span>");
01846                 gtk_label_set_markup (GTK_LABEL (label), markup);
01847                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01848                 gtk_widget_show (label);
01849                 g_free (markup);
01850  
01851                 /* Create combo boxe for user with some fixed values */
01852                 p_drate = gtk_combo_box_new_text();
01853                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "10");
01854                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "25");
01855                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "50");
01856                 gtk_combo_box_append_text(GTK_COMBO_BOX(p_drate), "60");
01857                 gtk_combo_box_set_active(GTK_COMBO_BOX(p_drate), 0);
01858                 gtk_table_attach_defaults (GTK_TABLE (table), p_drate, 1, 2, 1, 2);
01859                 gtk_widget_show (p_drate);
01860 
01861                 label = gtk_label_new (" ");
01862                 markup = g_markup_printf_escaped ("<span foreground=\"#333333\" font='8'><b>Note : The data frame sends according to new\n\t  data rate.</b></span>");
01863                 gtk_label_set_markup (GTK_LABEL (label), markup);
01864                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 2, 3);
01865                 gtk_widget_show (label);
01866                 g_free (markup);
01867                 
01868                 /* Add a "next" button to the bottom of the dialog */
01869                 next_butn = gtk_button_new_with_label ("Next");
01870 
01871                 /* Signal handling for buttons on Data Rate Window */
01872                 g_signal_connect (next_butn, "clicked", G_CALLBACK (validation_new_data_rate), NULL);
01873                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01874 
01875                 /* This makes it so the button is the default */
01876                 gtk_widget_set_can_default (next_butn, TRUE);
01877                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), next_butn, TRUE, TRUE, 0);
01878             
01879                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01880                 gtk_widget_grab_default (next_butn);
01881                 gtk_widget_show (next_butn);
01882 
01883                 /* Finally show the CCWin */
01884                 gtk_widget_show (CCWin);
01885         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void final_cfg_create (  ) 

Definition at line 1160 of file CfgGuiFunctions.c.

References _pmuStruct::cfg_modification_button, create_cfg(), _pmuStruct::create_cfg_button, _pmuStruct::header_frm_button, pmu_data, _pmuStruct::pmu_details_button, and validation_result().

Referenced by channel_names_for_digital(), and validation_digital_names().

01161         {
01162                 /* local variables */
01163                 int ret_val;
01164                 char *display_msg;
01165                 
01166                 /* To create CFG call 'create_cfg()' */
01167                 ret_val = create_cfg();
01168 
01169                 if(ret_val == 0)
01170                 {
01171                         /* Enable rest of the buttons on PMU Simulator Window */
01172                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->header_frm_button), TRUE);
01173                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->pmu_details_button), TRUE);
01174                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->cfg_modification_button), TRUE);
01175 
01176                         /* Disable create CFG buttons on PMU Simulator Window */
01177                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->create_cfg_button), FALSE);
01178 
01179                         display_msg = "\tConfiguration Frame for PMU successfully made\t\n";
01180                         validation_result (display_msg);        /* Show the success message to user */
01181                 }
01182                 else
01183                 {
01184                         display_msg = "\t\tConfiguration Frame for PMU failed.\t\t\n\t\t\t\tPlease try again\n";
01185                         validation_result (display_msg);        /* Show the unsuccess message to user */                
01186                 }
01187         };

Here is the call graph for this function:

Here is the caller graph for this function:

int final_cfg_update_call ( GtkButton *  but,
gpointer  udata 
)

Definition at line 2047 of file CfgGuiFunctions.c.

References CCWin, ConfigurationChange::data_rate_choice, new_cfg_info, ConfigurationChange::new_data_rate, and reconfig_cfg_CC().

Referenced by change_data_rate_option().

02048         {
02049                 new_cfg_info->data_rate_choice = 0; 
02050                 new_cfg_info->new_data_rate = 0;
02051 
02052                 /* Close/destroy the CCWin */
02053                 gtk_widget_destroy(CCWin);                              
02054 
02055                 /* Final call to recreate configuration frame */
02056                 reconfig_cfg_CC();
02057 
02058                 return 0;
02059         };

Here is the call graph for this function:

Here is the caller graph for this function:

void hdr_create_function ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 2068 of file CfgGuiFunctions.c.

References CCWin, HdrFrm, markup, and validation_hdr_frm().

Referenced by main().

02069         {
02070                 /* local variables */
02071                 GtkWidget *table, *label;
02072                 GtkWidget *close_butn, *vald_butn;
02073 
02074                 /* Create a new dialog window for the Header Frame Window */ 
02075                 CCWin = gtk_dialog_new ();
02076                 gtk_window_set_title (GTK_WINDOW (CCWin), "Header Frame");
02077                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
02078                 gtk_widget_set_size_request (CCWin, 500, 350);
02079                  
02080                 /* Create a table of 3 by 2 squares */
02081                 table = gtk_table_new (3, 2, FALSE);
02082             
02083                 /* Set the spacing to 30 on x */
02084                 gtk_table_set_row_spacings (GTK_TABLE (table), 30);
02085             
02086                 /* Pack the table into the window */
02087                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
02088                 gtk_widget_show (table);
02089 
02090                 label = gtk_label_new (" ");
02091                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter Header Frame Details</b></span>");
02092                 gtk_label_set_markup (GTK_LABEL (label), markup);
02093                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
02094                 gtk_widget_show (label);
02095                 g_free (markup);
02096  
02097                 /* Create text boxes for user to enter appropriate values */
02098                 HdrFrm = gtk_entry_new();
02099                 gtk_table_attach_defaults (GTK_TABLE (table), HdrFrm, 0, 1, 1, 2);
02100                 gtk_widget_show (HdrFrm);
02101 
02102                 label = gtk_label_new (" ");
02103                 markup = g_markup_printf_escaped ("<span foreground=\"#333333\" font='8'><b>Note : Header frame includes the information about the PMU, the data sources,\n\t  scaling, algorithms, filtering, or other related information.</b></span>");
02104                 gtk_label_set_markup (GTK_LABEL (label), markup);
02105                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
02106                 gtk_widget_show (label);
02107                 g_free (markup);
02108 
02109                 /* Add few buttons at the bottom of the dialog */
02110                 vald_butn = gtk_button_new_with_label ("Create");
02111                 close_butn = gtk_button_new_with_label ("Close");
02112 
02113                 /* Signal handling for buttons on Window */
02114                 g_signal_connect (vald_butn, "clicked", G_CALLBACK (validation_hdr_frm), (gpointer) "2");
02115                 g_signal_connect_swapped (close_butn, "clicked", G_CALLBACK (gtk_widget_destroy), CCWin);
02116                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
02117 
02118                 /* This makes it so the button is the default */
02119                 gtk_widget_set_can_default (vald_butn, TRUE);
02120                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), vald_butn, TRUE, TRUE, 0);
02121                 gtk_widget_set_can_default (close_butn, TRUE);
02122                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), close_butn, TRUE, TRUE, 0);
02123             
02124                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
02125                 gtk_widget_grab_default (vald_butn);
02126                 gtk_widget_show (vald_butn);
02127                 gtk_widget_grab_default (close_butn);
02128                 gtk_widget_show (close_butn);
02129 
02130                 /* Finally show the CCWin */
02131                 gtk_widget_show (CCWin);
02132         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void new_analog_num (  ) 

Definition at line 1483 of file CfgGuiFunctions.c.

References CCWin, markup, phtext, and validation_ph_an_num().

Referenced by new_channel_names_for_phasor(), and validation_new_phasor_names().

01484         {
01485                 /* local variables */
01486                 GtkWidget *table;
01487                 GtkWidget *next_butn, *label;
01488 
01489                 /* Create a new dialog window for the New Analog Channels */ 
01490                 CCWin = gtk_dialog_new ();
01491                 gtk_window_set_title (GTK_WINDOW (CCWin), "New Analog Channels");
01492                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01493                 gtk_widget_set_size_request (CCWin, 350, 300);
01494                  
01495                 /* Create a table of 3 by 3 squares */
01496                 table = gtk_table_new (3, 3, FALSE);
01497             
01498                 /* Set the spacing to 25 on x and 40 on y */
01499                 gtk_table_set_row_spacings (GTK_TABLE (table), 25);
01500                 gtk_table_set_col_spacings (GTK_TABLE (table), 40);
01501             
01502                 /* Pack the table into the window */
01503                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01504                 gtk_widget_show (table);
01505 
01506                 label = gtk_label_new (" ");
01507                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b> Enter number of new Analogs</b></span>");
01508                 gtk_label_set_markup (GTK_LABEL (label), markup);
01509                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01510                 gtk_widget_show (label);
01511                 g_free (markup);
01512  
01513                 /* Create text boxes for user to enter appropriate values */
01514                 phtext = gtk_entry_new ();
01515                 gtk_table_attach_defaults (GTK_TABLE (table), phtext, 1, 2, 1, 2);
01516                 gtk_widget_show (phtext);
01517                 
01518                 label = gtk_label_new (" ");
01519                 markup = g_markup_printf_escaped ("<span foreground=\"#333333\" font='8'><b>Note : The new analog channels will be added to\n\t  existing configuration frame.</b></span>");
01520                 gtk_label_set_markup (GTK_LABEL (label), markup);
01521                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 2, 3);
01522                 gtk_widget_show (label);
01523                 g_free (markup);
01524 
01525                 /* Add a "Next" button to the bottom of the dialog */
01526                 next_butn = gtk_button_new_with_label ("Next");
01527 
01528                 /* Signal handling for buttons on Window */
01529                 g_signal_connect (next_butn, "clicked", G_CALLBACK (validation_ph_an_num), (gpointer) "2");
01530                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01531 
01532                 /* This makes it so the button is the default. */
01533                 gtk_widget_set_can_default (next_butn, TRUE);
01534                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), next_butn, TRUE, TRUE, 0);
01535             
01536                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01537                 gtk_widget_grab_default (next_butn);
01538                 gtk_widget_show (next_butn);
01539 
01540                 /* Finally show the CCWin */
01541                 gtk_widget_show (CCWin);
01542         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void new_channel_names_for_analog (  ) 

Definition at line 1651 of file CfgGuiFunctions.c.

References CCWin, change_data_rate_option(), i, markup, ConfigurationChange::new_cfg_annmr_val, new_cfg_info, num_text, PhasorChWin, and validation_new_analog_names().

Referenced by validation_ph_an_num().

01652         {
01653                 /* new_analog number could be zero? */  
01654                 if(new_cfg_info->new_cfg_annmr_val > 0)
01655                 {
01656                         /* local variables */
01657                         int i;
01658                         char line[30];
01659                         GtkWidget *table, *scrolled_window;
01660                         GtkWidget *label, *next_button;
01661 
01662                         /* Create a new dialog window for the scrolled window to be packed into */
01663                         gtk_widget_destroy(CCWin);
01664                         PhasorChWin = gtk_dialog_new ();
01665                         g_signal_connect (PhasorChWin, "destroy", G_CALLBACK (gtk_widget_destroy), PhasorChWin);
01666                         gtk_window_set_title (GTK_WINDOW (PhasorChWin), "New Analog Channels");
01667                         gtk_container_set_border_width (GTK_CONTAINER (PhasorChWin), 10);
01668                         gtk_widget_set_size_request (PhasorChWin, 420, 350);
01669                  
01670                         /* Create a new scrolled window */
01671                         scrolled_window = gtk_scrolled_window_new (NULL, NULL);
01672                         gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
01673 
01674                         /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. GTK_POLICY_AUTOMATIC will automatically decide whether you need scrollbars,
01675                            whereas GTK_POLICY_ALWAYS will always leave the scrollbars there. The first one is the horizontal scrollbar, the second is vertical */
01676                         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
01677 
01678                         /* The dialog window is created with a vbox packed into it */                                                           
01679                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG(PhasorChWin)->vbox), scrolled_window, TRUE, TRUE, 0);
01680                         gtk_widget_show (scrolled_window);
01681 
01682                         /* Create a table of ? by 2 squares */
01683                         table = gtk_table_new (new_cfg_info->new_cfg_annmr_val+1, 2, FALSE);
01684             
01685                         /* Set the spacing to 10 on x and 30 on y */
01686                         gtk_table_set_row_spacings (GTK_TABLE (table), 10);
01687                         gtk_table_set_col_spacings (GTK_TABLE (table), 30);
01688             
01689                         /* Pack the table into the window */
01690                         gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
01691                         gtk_widget_show (table);
01692 
01693                         /* Add a "next" button to the bottom of the dialog */
01694                         next_button = gtk_button_new_with_label ("Next");
01695             
01696                         label = gtk_label_new (" ");
01697                         markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter New Analog Channel Names</b></span>");
01698                         gtk_label_set_markup (GTK_LABEL (label), markup);
01699                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01700                         gtk_widget_show (label);
01701                         g_free (markup);
01702 
01703                         /* This simply creates a grid of Lables with text on the table to demonstrate the scrolled window */
01704                         for(i=1; i<new_cfg_info->new_cfg_annmr_val+1; i++)
01705                         {
01706                                 memset(line,'\0',sizeof(line));
01707                                 sprintf(line, "New Analog Channel %d : ", i);
01708                                 label = gtk_label_new (line);
01709                                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i+1);
01710                                 gtk_widget_show (label);
01711                         }
01712 
01713                         for(i=1; i<new_cfg_info->new_cfg_annmr_val+1; i++)
01714                         {
01715                                 num_text[i] = gtk_entry_new ();
01716                                 gtk_entry_set_max_length ((GtkEntry *)num_text[i], 16);
01717                                 gtk_table_attach_defaults (GTK_TABLE (table), num_text[i], 1, 2, i, i+1);
01718                                 gtk_widget_show (num_text[i]);
01719                         }
01720 
01721                         /* Signal handling for Next button on Window */
01722                         g_signal_connect_swapped (next_button, "clicked", G_CALLBACK (validation_new_analog_names), NULL);
01723             
01724                         /* This makes it so the button is the default */
01725                         gtk_widget_set_can_default (next_button, TRUE);
01726                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (PhasorChWin)->action_area), next_button, TRUE, TRUE, 0);
01727             
01728                         /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01729                         gtk_widget_grab_default (next_button);
01730                         gtk_widget_show (next_button);
01731 
01732                         /* Finally show the PhasorChWin */
01733                         gtk_widget_show (PhasorChWin);
01734                 }
01735                 else    /* if new_phasor < 0 */
01736                 {
01737                         /* Close/destroy the CCWin */
01738                         gtk_widget_destroy(CCWin);
01739 
01740                         /* Next call to data rate change option? */
01741                         change_data_rate_option();
01742                 }
01743         };

Here is the call graph for this function:

Here is the caller graph for this function:

void new_channel_names_for_phasor (  ) 

Definition at line 1550 of file CfgGuiFunctions.c.

References CCWin, i, markup, new_analog_num(), new_cfg_info, ConfigurationChange::new_cfg_phnmr_val, num_text, PhasorChWin, and validation_new_phasor_names().

Referenced by validation_ph_an_num().

01551         {
01552                 /* new_phasor number could be zero? */  
01553                 if(new_cfg_info->new_cfg_phnmr_val > 0)
01554                 {
01555                         /* local variables */
01556                         int i;
01557                         char line[30];
01558                         GtkWidget *table, *scrolled_window;
01559                         GtkWidget *label, *next_button;
01560           
01561                         /* Create a new dialog window for the scrolled window to be packed into */
01562                         gtk_widget_destroy(CCWin);
01563                         PhasorChWin = gtk_dialog_new ();
01564                         g_signal_connect (PhasorChWin, "destroy", G_CALLBACK (gtk_widget_destroy), PhasorChWin);
01565                         gtk_window_set_title (GTK_WINDOW (PhasorChWin), "New Phasor");
01566                         gtk_container_set_border_width (GTK_CONTAINER (PhasorChWin), 10);
01567                         gtk_widget_set_size_request (PhasorChWin, 420, 350);
01568                  
01569                         /* Create a new scrolled window */
01570                         scrolled_window = gtk_scrolled_window_new (NULL, NULL);
01571                         gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
01572 
01573                         /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. GTK_POLICY_AUTOMATIC will automatically decide whether you need scrollbars,
01574                            whereas GTK_POLICY_ALWAYS will always leave the scrollbars there. The first one is the horizontal scrollbar, the second is vertical */
01575                         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
01576 
01577                         /* The dialog window is created with a vbox packed into it */                                                           
01578                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG(PhasorChWin)->vbox), scrolled_window, TRUE, TRUE, 0);
01579                         gtk_widget_show (scrolled_window);
01580 
01581                         /* Create a table of ? by 2 squares */
01582                         table = gtk_table_new (new_cfg_info->new_cfg_phnmr_val+1, 2, FALSE);
01583             
01584                         /* Set the spacing to 10 on x and 30 on y */
01585                         gtk_table_set_row_spacings (GTK_TABLE (table), 10);
01586                         gtk_table_set_col_spacings (GTK_TABLE (table), 30);
01587             
01588                         /* Pack the table into the window */
01589                         gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
01590                         gtk_widget_show (table);
01591 
01592                         /* Add a "next" button to the bottom of the dialog */
01593                         next_button = gtk_button_new_with_label ("Next");
01594             
01595                         label = gtk_label_new (" ");
01596                         markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter New Phasor Channel Names</b></span>");
01597                         gtk_label_set_markup (GTK_LABEL (label), markup);
01598                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01599                         gtk_widget_show (label);
01600                         g_free (markup);
01601 
01602                         /* This simply creates a grid of Lables with text on the table to demonstrate the scrolled window */
01603                         for(i=1; i<new_cfg_info->new_cfg_phnmr_val+1; i++)
01604                         {
01605                                 memset(line,'\0',sizeof(line));
01606                                 sprintf(line, "New Phasor Channel %d : ", i);
01607                                 label = gtk_label_new (line);
01608                                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i+1);
01609                                 gtk_widget_show (label);
01610                         }
01611 
01612                         for(i=1; i<new_cfg_info->new_cfg_phnmr_val+1; i++)
01613                         {
01614                                 num_text[i] = gtk_entry_new ();
01615                                 gtk_entry_set_max_length ((GtkEntry *)num_text[i], 16);
01616                                 gtk_table_attach_defaults (GTK_TABLE (table), num_text[i], 1, 2, i, i+1);
01617                                 gtk_widget_show (num_text[i]);
01618                         }
01619 
01620                         /* Signal handling for Next button on Window */
01621                         g_signal_connect_swapped (next_button, "clicked", G_CALLBACK (validation_new_phasor_names), NULL);
01622             
01623                         /* This makes it so the button is the default */
01624                         gtk_widget_set_can_default (next_button, TRUE);
01625                         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (PhasorChWin)->action_area), next_button, TRUE, TRUE, 0);
01626             
01627                         /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01628                         gtk_widget_grab_default (next_button);
01629                         gtk_widget_show (next_button);
01630 
01631                         /* Finally show the PhasorChWin */
01632                         gtk_widget_show (PhasorChWin);
01633                 }
01634 
01635                 else    /* if new_phasor < 0 */
01636                 {
01637                         /* Close/destroy the CCWin */
01638                         gtk_widget_destroy(CCWin);
01639 
01640                         /* Next call to new analog numbers */
01641                         new_analog_num();
01642                 }
01643         };

Here is the call graph for this function:

Here is the caller graph for this function:

void new_phasor_num ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1411 of file CfgGuiFunctions.c.

References ConfigurationChange::add_remove_choice, CCWin, markup, new_cfg_info, phtext, and validation_ph_an_num().

Referenced by Change_pmu_configuration().

01412         {
01413                 /* local variables */
01414                 GtkWidget *table;
01415                 GtkWidget *next_butn, *label;
01416 
01417                 /* Allocate the memory for the ConfigurationChange object */
01418                 new_cfg_info = malloc(sizeof(struct ConfigurationChange));
01419                 new_cfg_info->add_remove_choice = 1; 
01420 
01421                 /* Create a new dialog window for New Phasor Channels */ 
01422                 gtk_widget_destroy(CCWin);                              
01423                 CCWin = gtk_dialog_new ();
01424                 gtk_window_set_title (GTK_WINDOW (CCWin), "New Phasor Channels");
01425                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01426                 gtk_widget_set_size_request (CCWin, 350, 300);
01427                  
01428                 /* Create a table of 3 by 3 squares. */
01429                 table = gtk_table_new (3, 3, FALSE);
01430             
01431                 /* Set the spacing to 25 on x and 40 on y */
01432                 gtk_table_set_row_spacings (GTK_TABLE (table), 25);
01433                 gtk_table_set_col_spacings (GTK_TABLE (table), 40);
01434             
01435                 /* Pack the table into the window */
01436                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01437                 gtk_widget_show (table);
01438 
01439                 label = gtk_label_new (" ");
01440                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b> Enter number of new Phasors</b></span>");
01441                 gtk_label_set_markup (GTK_LABEL (label), markup);
01442                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
01443                 gtk_widget_show (label);
01444                 g_free (markup);
01445  
01446                 /* Create text boxes for user to enter appropriate values */
01447                 phtext = gtk_entry_new ();
01448                 gtk_table_attach_defaults (GTK_TABLE (table), phtext, 1, 2, 1, 2);
01449                 gtk_widget_show (phtext);
01450                 
01451                 label = gtk_label_new (" ");
01452                 markup = g_markup_printf_escaped ("<span foreground=\"#333333\" font='8'><b>Note : The new phasor channels will be added to\n\t  existing configuration frame.</b></span>");
01453                 gtk_label_set_markup (GTK_LABEL (label), markup);
01454                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 2, 3);
01455                 gtk_widget_show (label);
01456                 g_free (markup);
01457 
01458                 /* Add a "Next" button to the bottom of the dialog */
01459                 next_butn = gtk_button_new_with_label ("Next");
01460 
01461                 /* Signal handling for buttons on Window */
01462                 g_signal_connect (next_butn, "clicked", G_CALLBACK (validation_ph_an_num), (gpointer) "1");
01463                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01464 
01465                 /* This makes it so the button is the default */
01466                 gtk_widget_set_can_default (next_butn, TRUE);
01467                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), next_butn, TRUE, TRUE, 0);
01468             
01469                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01470                 gtk_widget_grab_default (next_butn);
01471                 gtk_widget_show (next_butn);
01472 
01473                 /* Finally show the CCWin */
01474                 gtk_widget_show (CCWin);
01475         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_analog_num (  ) 

Definition at line 1972 of file CfgGuiFunctions.c.

References CCWin, ConfigurationFrame::cfg_annmr_val, cfg_info, markup, phtext, and validation_remove_ph_an_num().

Referenced by validation_remove_ph_an_num().

01973         {
01974                 /* local variables */
01975                 char line[50], buff[10];
01976                 GtkWidget *table;
01977                 GtkWidget *next_butn, *label;
01978 
01979                 /* Close/destroy the CCWin */
01980                 gtk_widget_destroy(CCWin);                              
01981 
01982                 /* Create a new dialog window for the Remove Analog Window */ 
01983                 CCWin = gtk_dialog_new ();
01984                 gtk_window_set_title (GTK_WINDOW (CCWin), "Remove Analog Window");
01985                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01986                 gtk_widget_set_size_request (CCWin, 350, 300);
01987                  
01988                 /* Create a table of 5 by 3 squares */
01989                 table = gtk_table_new (5, 3, FALSE);
01990             
01991                 /* Set the spacing to 5 on x and 40 on y */
01992                 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
01993                 gtk_table_set_col_spacings (GTK_TABLE (table), 40);
01994             
01995                 /* Pack the table into the window */
01996                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01997                 gtk_widget_show (table);
01998 
01999                 /* This simply creates a grid of Lables with text on the table */
02000                 label = gtk_label_new (" ");
02001                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter Number of Analog</b></span>");
02002                 gtk_label_set_markup (GTK_LABEL (label), markup);
02003                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
02004                 gtk_widget_show (label);
02005                 g_free (markup);
02006  
02007                 /* Create text boxes for user to enter appropriate values */
02008                 phtext = gtk_entry_new ();
02009                 gtk_table_attach_defaults (GTK_TABLE (table), phtext, 1, 2, 3, 4);
02010                 gtk_widget_show (phtext);
02011 
02012                 memset(line, '\0', 50);
02013                 memset(buff, '\0', 10);
02014                 strcat(line, "Note : Maximum Removal upto ");                   
02015                 sprintf(buff,"%d",cfg_info->cfg_annmr_val);
02016                 strcat(line, buff);             
02017                 strcat(line, "       ");                
02018                 label = gtk_label_new (line);
02019                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 4, 5);
02020                 gtk_widget_show (label);
02021 
02022                 /* Add a "next" button to the bottom of the dialog */
02023                 next_butn = gtk_button_new_with_label ("Next");
02024 
02025                 /* Signal handling for buttons on Window */
02026                 g_signal_connect (next_butn, "clicked", G_CALLBACK (validation_remove_ph_an_num), (gpointer) "2");
02027                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
02028 
02029                 /* This makes it so the button is the default */
02030                 gtk_widget_set_can_default (next_butn, TRUE);
02031                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), next_butn, TRUE, TRUE, 0);
02032             
02033                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
02034                 gtk_widget_grab_default (next_butn);
02035                 gtk_widget_show (next_butn);
02036 
02037                 /* Finally show the CCWin */
02038                 gtk_widget_show (CCWin);
02039         };      

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_phasor_num ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 1894 of file CfgGuiFunctions.c.

References ConfigurationChange::add_remove_choice, CCWin, cfg_info, ConfigurationFrame::cfg_phnmr_val, markup, new_cfg_info, phtext, and validation_remove_ph_an_num().

Referenced by Change_pmu_configuration().

01895         {
01896                 /* local variables */
01897                 char line[50], buff[10];
01898                 GtkWidget *table;
01899                 GtkWidget *next_butn, *label;
01900 
01901                 /* Allocate the memory for the ConfigurationChange object */
01902                 new_cfg_info = malloc(sizeof(struct ConfigurationChange));
01903                 new_cfg_info->add_remove_choice = 2; 
01904 
01905                 /* Create a new dialog window for the Remove Phasor */ 
01906                 gtk_widget_destroy(CCWin);                              
01907                 CCWin = gtk_dialog_new ();
01908                 gtk_window_set_title (GTK_WINDOW (CCWin), "Remove Phasor");
01909                 gtk_container_set_border_width (GTK_CONTAINER (CCWin), 10);
01910                 gtk_widget_set_size_request (CCWin, 350, 300);
01911                  
01912                 /* Create a table of 5 by 3 squares */
01913                 table = gtk_table_new (5, 3, FALSE);
01914             
01915                 /* Set the spacing to 5 on x and 40 on y */
01916                 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
01917                 gtk_table_set_col_spacings (GTK_TABLE (table), 40);
01918             
01919                 /* Pack the table into the window */
01920                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(CCWin)->vbox), table, TRUE, TRUE, 0);
01921                 gtk_widget_show (table);
01922 
01923                 /* This simply creates a grid of Lables with text on the table */
01924                 label = gtk_label_new (" ");
01925                 markup = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>Enter Number of Phasors</b></span>");
01926                 gtk_label_set_markup (GTK_LABEL (label), markup);
01927                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
01928                 gtk_widget_show (label);
01929                 g_free (markup);
01930  
01931                 /* Create text boxes for user to enter appropriate values */
01932                 phtext = gtk_entry_new ();
01933                 gtk_table_attach_defaults (GTK_TABLE (table), phtext, 1, 2, 3, 4);
01934                 gtk_widget_show (phtext);
01935 
01936                 memset(line, '\0', 50);
01937                 memset(buff, '\0', 10);
01938                 strcat(line, "Note : Maximum Removal upto ");                   
01939                 sprintf(buff,"%d",cfg_info->cfg_phnmr_val);
01940                 strcat(line, buff);             
01941                 strcat(line, "       ");                
01942                 label = gtk_label_new (line);
01943                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 4, 5);
01944                 gtk_widget_show (label);
01945                 
01946                 /* Add a "next" button to the bottom of the dialog */
01947                 next_butn = gtk_button_new_with_label ("Next");
01948 
01949                 /* Signal handling for buttons on Window */
01950                 g_signal_connect (next_butn, "clicked", G_CALLBACK (validation_remove_ph_an_num), (gpointer) "1");
01951                 g_signal_connect_swapped (CCWin, "response", G_CALLBACK (gtk_widget_destroy), CCWin);
01952 
01953                 /* This makes it so the button is the default */
01954                 gtk_widget_set_can_default (next_butn, TRUE);
01955                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (CCWin)->action_area), next_butn, TRUE, TRUE, 0);
01956             
01957                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01958                 gtk_widget_grab_default (next_butn);
01959                 gtk_widget_show (next_butn);
01960 
01961                 /* Finally show the CCWin */
01962                 gtk_widget_show (CCWin);
01963         };      

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_analog_names ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 266 of file CfgGuiFunctions.c.

References AnalogChWin, ConfigurationFrame::cfg_analog_channels, ConfigurationFrame::cfg_annmr_val, cfg_info, channel_names_for_digital(), i, j, num_text, and validation_result().

Referenced by channel_names_for_analog().

00267         {
00268                 /* local variables */
00269                 int ia, i, j, ia1 = 0, vtr;
00270                 char stn[16], c = ' ';
00271                 char *display_msg;
00272                 const char *aa[20];
00273 
00274                 /* First get how many Analog channel we have? */
00275                 vtr = cfg_info->cfg_annmr_val+1;
00276                 memset(stn, '\0', 16);  
00277 
00278                 /* Allocate the memory for Analog channel names */
00279                 cfg_info->cfg_analog_channels = (char *)malloc((vtr*16) * sizeof(char));
00280                 memset(cfg_info->cfg_analog_channels, '\0', sizeof(cfg_info->cfg_analog_channels));     
00281 
00282                 for (ia=1; ia<vtr; ia++)
00283                 {       
00284                         /* Get the text entry value filled by user */
00285                         aa[ia] = gtk_entry_get_text(GTK_ENTRY(num_text[ia]));
00286 
00287                         if(strlen(aa[ia]) == 0)
00288                         {
00289                                 free (cfg_info->cfg_analog_channels);
00290                                 display_msg = "\t\tPlease enter Analog channel name\t\t\n";
00291                                 validation_result (display_msg);        /* Show the unsuccess message to user */
00292                                 return 1;
00293                         }                       
00294                         else
00295                         {
00296                                 memset(stn, '\0', 16);
00297                                 strcpy(stn, aa[ia]);
00298                                 j = strlen(stn);
00299                                 if(j < 17)
00300                                 {
00301                                         for(i = j; i < 16 ; i++)
00302                                         {
00303                                                 stn[i] =  c;
00304                                         }
00305                                 }
00306                         }
00307 
00308                         for (i=0; i< 16 && i< vtr*16; i++, ia1++) 
00309                         {
00310                                 /* Copy all phasor name in an array */
00311                                 cfg_info->cfg_analog_channels[ia1] = stn[i]; 
00312                         }               
00313                 }
00314 
00315                 /* Close/destroy the AnalogChWin */
00316                 gtk_widget_destroy(AnalogChWin);                        
00317 
00318                 /* Next call for Enter Digital channels */
00319                 channel_names_for_digital ();
00320 
00321                 return 0;
00322         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_cfg_create (  ) 

Definition at line 85 of file CfgGuiFunctions.c.

References ConfigurationFrame::cfg_af, ConfigurationFrame::cfg_annmr_val, ConfigurationFrame::cfg_dataRate, ConfigurationFrame::cfg_dgnmr_val, ConfigurationFrame::cfg_fdf, cfg_info, _pmuStruct::cfg_modification_button, ConfigurationFrame::cfg_pf, ConfigurationFrame::cfg_phnmr_val, ConfigurationFrame::cfg_pmuID, ConfigurationFrame::cfg_pn, cfg_setup_window, ConfigurationFrame::cfg_STNname, channel_names_for_phasor(), _pmuStruct::header_frm_button, i, isNumber(), j, p_af, p_anNumber, p_dgNumber, p_drate, p_ff, p_id, p_pf, p_phNumber, p_pn, p_stn, pmu_data, _pmuStruct::pmu_details_button, and validation_result().

Referenced by cfg_create_function().

00086         {
00087                 /* local variables */
00088                 int i, j;
00089                 const char *text, *text1, *text2, *text3, *text4;
00090                 const char *text5, *text6, *text7, *text8, *text9;
00091                 char *display_msg, stn[16], c = ' ';
00092         
00093                 /* Get the text entries  and combo box values filled by user */
00094                 text  = gtk_entry_get_text(GTK_ENTRY(p_id));
00095                 text1 = gtk_entry_get_text(GTK_ENTRY(p_stn));
00096                 text2 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_ff));
00097                 text3 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_af));
00098                 text4 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_pf));
00099                 text5 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_pn));
00100                 text6 = gtk_entry_get_text(GTK_ENTRY(p_phNumber));
00101                 text7 = gtk_entry_get_text(GTK_ENTRY(p_anNumber));
00102                 text8 = gtk_entry_get_text(GTK_ENTRY(p_dgNumber));
00103                 text9 = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_drate));
00104 
00105                 if(!isNumber((char *)text))     /* Check text_box entry for valid integer or not?  */
00106                 {
00107                         display_msg = "\tPlease enter valid value for PMU ID code\t\n";
00108                         validation_result (display_msg);        /* Show the unsuccess message to user */
00109                         return 0;
00110                 }
00111                 else if(strlen(text1) == 0)     /* Check text_box entry should not be NULL */           
00112                 { 
00113                         display_msg = "\tPlease enter  PMU Station name\t\n";
00114                         validation_result (display_msg);        /* Show the unsuccess message to user */
00115                         return 0;
00116                 }
00117                 else if(!isNumber((char *)text6) && atoi(text6) > 0)    /* Check text_box entry for valid integer or not? as well as greater than one */
00118                 { 
00119                         display_msg = "\tPlease enter valid value for Phasor Number\t\n";
00120                         validation_result (display_msg);        /* Show the unsuccess message to user */
00121                         return 0;
00122                 }
00123                 else if(!isNumber((char *)text7))               /* Check text_box entry for valid integer or not?  */
00124                 { 
00125                         display_msg = "\tPlease enter valid value for Analog Number\t\n";
00126                         validation_result (display_msg);        /* Show the unsuccess message to user */
00127                         return 0;
00128                 }
00129                 else if(!isNumber((char *)text8))               /* Check text_box entry for valid integer or not?  */
00130                 { 
00131                         display_msg = "\tPlease enter valid value for Digital Number\t\n";
00132                         validation_result (display_msg);        /* Show the unsuccess message to user */
00133                         return 0;
00134                 }
00135                 else            /* Only if all the text_box entries were right */
00136                 {
00137                         /* Allocate the memory for the ConfigurationFrame object */
00138                         cfg_info = malloc(sizeof(struct ConfigurationFrame));
00139                         cfg_info->cfg_STNname = malloc(16);
00140                         memset(cfg_info->cfg_STNname,'\0',16);
00141 
00142                         memset(stn, '\0', 16);
00143                         strcpy(stn, text1);
00144                         j = strlen(stn);
00145                         for(i = j; i < 16 ; i++)
00146                         {
00147                                 stn[i] =  c;
00148                         }
00149 
00150                         cfg_info->cfg_pmuID = atoi(text);
00151                         strcpy(cfg_info->cfg_STNname, stn);
00152                         cfg_info->cfg_phnmr_val = atoi(text6);
00153                         cfg_info->cfg_annmr_val = atoi(text7); 
00154                         cfg_info->cfg_dgnmr_val = atoi(text8);
00155                         cfg_info->cfg_dataRate = atoi(text9);
00156                         
00157                         if(!strcmp(text2, "Fix Point"))
00158                                 cfg_info->cfg_fdf = 0; 
00159                         else
00160                                 cfg_info->cfg_fdf = 1; 
00161 
00162                         if(!strcmp(text3, "Fix Point"))
00163                                 cfg_info->cfg_af = 0; 
00164                         else
00165                                 cfg_info->cfg_af = 1; 
00166 
00167                         if(!strcmp(text4, "Fix Point"))
00168                                 cfg_info->cfg_pf = 0; 
00169                         else
00170                                 cfg_info->cfg_pf = 1; 
00171 
00172                         if(!strcmp(text5, "Ractangular"))
00173                                 cfg_info->cfg_pn = 0; 
00174                         else
00175                                 cfg_info->cfg_pn = 1; 
00176 
00177                         /* Close/destroy the cfg_setup_window */
00178                         gtk_widget_destroy(cfg_setup_window);
00179 
00180                         /* Enable all (mentioned) buttons on main PMU Simulator main window */
00181                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->header_frm_button), TRUE);
00182                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->pmu_details_button), TRUE);
00183                         gtk_widget_set_sensitive(GTK_WIDGET(pmu_data->cfg_modification_button), TRUE);
00184 
00185                         /* Next call for Enter Phasor channels */
00186                         channel_names_for_phasor ();
00187 
00188                         return 1;
00189                 }
00190         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_digital_names ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 332 of file CfgGuiFunctions.c.

References AnalogChWin, ConfigurationFrame::cfg_dgnmr_val, ConfigurationFrame::cfg_digital_channels, cfg_info, final_cfg_create(), i, j, num_text, and validation_result().

Referenced by channel_names_for_digital().

00333         {
00334                 /* local variables */
00335                 int ia, i, j, ia1 = 0, vtr;
00336                 char stn[16], c = ' ';
00337                 char *display_msg;
00338                 const char *aa[20];
00339 
00340                 /* First get how many Digital channel we have? */
00341                 vtr = cfg_info->cfg_dgnmr_val*16+1;
00342                 memset(stn, '\0', 16);  
00343 
00344                 /* Allocate the memory for Digital channel names */
00345                 cfg_info->cfg_digital_channels = (char *)malloc((vtr*16) * sizeof(char));
00346                 memset(cfg_info->cfg_digital_channels, '\0', sizeof(cfg_info->cfg_digital_channels));   
00347 
00348                 for (ia=1; ia<vtr; ia++)
00349                 {       
00350                         /* Get the text entry value filled by user */
00351                         aa[ia] = gtk_entry_get_text(GTK_ENTRY(num_text[ia]));
00352 
00353                         if(strlen(aa[ia]) == 0)
00354                         {
00355                                 free (cfg_info->cfg_digital_channels);
00356                                 display_msg = "\t\tPlease enter Digital channel names\t\t\n";
00357                                 validation_result (display_msg);        /* Show the unsuccess message to user */
00358                                 return 1;
00359                         }                       
00360                         else
00361                         {
00362                                 memset(stn, '\0', 16);
00363                                 strcpy(stn, aa[ia]);
00364                                 j = strlen(stn);
00365                                 if(j < 17)
00366                                 {
00367                                         for(i = j; i < 16 ; i++)
00368                                         {
00369                                                 stn[i] =  c;
00370                                         }
00371                                 }
00372                         }
00373 
00374                         for (i=0; i< 16 && i< vtr*16; i++, ia1++) 
00375                         {
00376                                 /* Copy all digital name in an array */
00377                                 cfg_info->cfg_digital_channels[ia1] = stn[i]; 
00378                         }               
00379                 }
00380 
00381                 /* Close/destroy the AnalogChWin */
00382                 gtk_widget_destroy(AnalogChWin);                        
00383 
00384                 /* Next call for finaly create Configuration Frame */
00385                 final_cfg_create ();
00386 
00387                 return 0;
00388         };

Here is the call graph for this function:

Here is the caller graph for this function:

void validation_hdr_frm ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 676 of file CfgGuiFunctions.c.

References CCWin, hdr_frame, HdrFrm, header_frm_gen(), i, j, and validation_result().

Referenced by hdr_create_function().

00677         {
00678                 /* local variables */
00679                 int i, j;
00680                 const char *text;
00681 
00682                 /* Get the text entry value filled by user */
00683                 text = gtk_entry_get_text(GTK_ENTRY(HdrFrm));
00684                 i = strlen(text);
00685 
00686                 if(i > 0)
00687                 {
00688                         hdr_frame = (char *)malloc(i * sizeof(char));
00689                         memset(hdr_frame, '\0', sizeof(hdr_frame));     
00690                         
00691                         for (j=0; j<i ; j++) 
00692                         {
00693                                 hdr_frame[j] = text[j]; 
00694                         }
00695 
00696                         /* Close/destroy the CCWin */
00697                         gtk_widget_destroy(CCWin);                              
00698 
00699                         /* Finally call below function to generate header frame */
00700                         header_frm_gen(i);                                      
00701                 }
00702                 else
00703                 {
00704                         validation_result ("Pleas enter the Header Frame details...!!!");       /* Show the unsuccess message to user */
00705                 }
00706         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_new_analog_names ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 515 of file CfgGuiFunctions.c.

References change_data_rate_option(), i, j, ConfigurationChange::new_cfg_analog_channels, ConfigurationChange::new_cfg_annmr_val, new_cfg_info, num_text, PhasorChWin, and validation_result().

Referenced by new_channel_names_for_analog().

00516         {
00517                 /* local variables */
00518                 int ia, i, j, ia1 = 0, vtr;
00519                 char stn[16], c = ' ';
00520                 char *display_msg;
00521                 const char *aa[20];
00522 
00523                 /* First get how many New Analog channel he wants to add? */
00524                 vtr = new_cfg_info->new_cfg_annmr_val+1;
00525                 memset(stn, '\0', 16);  
00526 
00527                 /* Allocate the memory for New Analog channel names */
00528                 new_cfg_info->new_cfg_analog_channels = (char *)malloc((vtr*16) * sizeof(char));
00529                 memset(new_cfg_info->new_cfg_analog_channels, '\0', sizeof(new_cfg_info->new_cfg_analog_channels));     
00530 
00531                 for (ia=1; ia<vtr; ia++)
00532                 {       
00533                         /* Get the text entry value filled by user */
00534                         aa[ia] = gtk_entry_get_text(GTK_ENTRY(num_text[ia]));
00535 
00536                         if(strlen(aa[ia]) == 0)
00537                         {
00538                                 free (new_cfg_info->new_cfg_analog_channels);
00539                                 display_msg = "\t\tPlease enter Analog channel name\t\t\n";
00540                                 validation_result (display_msg);        /* Show the unsuccess message to user */
00541                                 return 1;
00542                         }                       
00543                         else
00544                         {
00545                                 memset(stn, '\0', 16);
00546                                 strcpy(stn, aa[ia]);
00547                                 j = strlen(stn);
00548                                 if(j < 17)
00549                                 {
00550                                         for(i = j; i < 16 ; i++)
00551                                         {
00552                                                 stn[i] =  c;
00553                                         }
00554                                 }
00555                         }
00556 
00557                         for (i=0; i< 16 && i< vtr*16; i++, ia1++) 
00558                         {
00559                                 /* Copy all Analog name in an array */
00560                                 new_cfg_info->new_cfg_analog_channels[ia1] = stn[i]; 
00561                         }               
00562                 }
00563 
00564                 /* Close/destroy the PhasorChWin */
00565                 gtk_widget_destroy(PhasorChWin);                                
00566 
00567                 /* Next call for Data Rate change option? */
00568                 change_data_rate_option();
00569 
00570                 return 0;
00571         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_new_data_rate ( GtkButton *  but,
gpointer  udata 
)

Definition at line 581 of file CfgGuiFunctions.c.

References CCWin, ConfigurationChange::data_rate_choice, isNumber(), new_cfg_info, ConfigurationChange::new_data_rate, p_drate, reconfig_cfg_CC(), and validation_result().

Referenced by enter_new_data_rate().

00582         {
00583                 /* local variables */
00584                 char *display_msg;
00585                 const char *text;
00586 
00587                 /* Get the combo box value selected by user */
00588                 text  = gtk_combo_box_get_active_text(GTK_COMBO_BOX(p_drate));
00589 
00590                 if(isNumber((char *)text))      /* Check text_box entry for valid integer or not?  */
00591                 {
00592                         new_cfg_info->data_rate_choice = 1; 
00593                         new_cfg_info->new_data_rate = atoi(text); 
00594 
00595                         /* Close/destroy the CCWin */
00596                         gtk_widget_destroy(CCWin);                              
00597 
00598                         /* Final call to recreate configuration frame */
00599                         reconfig_cfg_CC();
00600 
00601                         return 0;
00602                 }
00603                 else
00604                 {
00605                         display_msg = "\tPlease enter valid value for data rate.\t\n";
00606                         validation_result (display_msg);        /* Show the unsuccess message to user */
00607                         return 1;
00608                 }
00609         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_new_phasor_names ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 449 of file CfgGuiFunctions.c.

References i, j, new_analog_num(), new_cfg_info, ConfigurationChange::new_cfg_phasor_channels, ConfigurationChange::new_cfg_phnmr_val, num_text, PhasorChWin, and validation_result().

Referenced by new_channel_names_for_phasor().

00450         {
00451                 /* local variables */
00452                 int ia, i, j, ia1 = 0, vtr;
00453                 char stn[16], c = ' ';
00454                 char *display_msg;
00455                 const char *aa[20];
00456 
00457                 /* First get how many New Phasor channel he wants to add? */
00458                 vtr = new_cfg_info->new_cfg_phnmr_val+1;
00459                 memset(stn, '\0', 16);  
00460 
00461                 /* Allocate the memory for New Phasor channel names */
00462                 new_cfg_info->new_cfg_phasor_channels = (char *)malloc((vtr*16) * sizeof(char));
00463                 memset(new_cfg_info->new_cfg_phasor_channels, '\0', sizeof(new_cfg_info->new_cfg_phasor_channels));     
00464 
00465                 for (ia=1; ia<vtr; ia++)
00466                 {       
00467                         /* Get the text entry value filled by user */
00468                         aa[ia] = gtk_entry_get_text(GTK_ENTRY(num_text[ia]));
00469 
00470                         if(strlen(aa[ia]) == 0)
00471                         {
00472                                 free (new_cfg_info->new_cfg_phasor_channels);
00473                                 display_msg = "\t\tPlease enter Phasor channel name\t\t\n";
00474                                 validation_result (display_msg);                /* Show the unsuccess message to user */
00475                                 return 1;
00476                         }                       
00477                         else
00478                         {
00479                                 memset(stn, '\0', 16);
00480                                 strcpy(stn, aa[ia]);
00481                                 j = strlen(stn);
00482                                 if(j < 17)
00483                                 {
00484                                         for(i = j; i < 16 ; i++)
00485                                         {
00486                                                 stn[i] =  c;
00487                                         }
00488                                 }
00489                         }
00490 
00491                         for (i=0; ((i< 16) && (i< vtr*16)); i++, ia1++) 
00492                         {
00493                                 /* Copy all phasor name in an array */
00494                                 new_cfg_info->new_cfg_phasor_channels[ia1] = stn[i]; 
00495                         }               
00496                 }
00497 
00498                 /* Close/destroy the PhasorChWin */
00499                 gtk_widget_destroy(PhasorChWin);                                
00500 
00501                 /* Next call for Enter New Phasor channels */
00502                 new_analog_num();
00503 
00504                 return 0;
00505         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_ph_an_num ( GtkButton *  but,
gpointer  udata 
)

Definition at line 399 of file CfgGuiFunctions.c.

References isNumber(), ConfigurationChange::new_cfg_annmr_val, new_cfg_info, ConfigurationChange::new_cfg_phnmr_val, new_channel_names_for_analog(), new_channel_names_for_phasor(), phtext, and validation_result().

Referenced by new_analog_num(), and new_phasor_num().

00400         {
00401                 /* local variables */
00402                 const char *text;
00403                 char *display_msg, find_butn[2];
00404 
00405                 /* Get the text entry value filled by user */
00406                 text  = gtk_entry_get_text(GTK_ENTRY(phtext));
00407 
00408                 /* Use udata for idenifing signal button */
00409                 strcpy(find_butn,(char *) udata);
00410 
00411                 if(isNumber((char *)text))      /* Check text_box entry for valid integer or not?  */
00412                 {
00413                         if(!strcmp(find_butn, "1"))     /* If user wants to add new phasor channels */
00414                         {
00415                                 new_cfg_info->new_cfg_phnmr_val = atoi(text); 
00416 
00417                                 /* Next call for Enter New Phasor channels */
00418                                 new_channel_names_for_phasor ();
00419 
00420                                 return 0;
00421                         }
00422                         else if(!strcmp(find_butn, "2"))        /* If user wants to add new Analog channels */
00423                         {
00424                                 new_cfg_info->new_cfg_annmr_val = atoi(text); 
00425 
00426                                 /* Next call for Enter New Phasor channels */
00427                                 new_channel_names_for_analog ();
00428 
00429                                 return 0;
00430                         }
00431                 }
00432                 else
00433                 {
00434                         display_msg = "\nPlease enter the valid value in the given field\n";
00435                         validation_result (display_msg);                /* Show the unsuccess message to user */
00436                         return 1;
00437                 }
00438                 return 1;
00439         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_phasor_names ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 200 of file CfgGuiFunctions.c.

References cfg_info, ConfigurationFrame::cfg_phasor_channels, ConfigurationFrame::cfg_phnmr_val, channel_names_for_analog(), i, j, num_text, PhasorChWin, and validation_result().

Referenced by channel_names_for_phasor().

00201         {
00202                 /* local variables */
00203                 int ia, i, j, ia1 = 0, vtr;
00204                 char stn[16], c = ' ';
00205                 char *display_msg;
00206                 const char *aa[20];
00207 
00208                 /* First get how many Phasor channel we have? */
00209                 vtr = cfg_info->cfg_phnmr_val+1;
00210                 memset(stn, '\0', 16);  
00211 
00212                 /* Allocate the memory for Phasor channel names */
00213                 cfg_info->cfg_phasor_channels = (char *)malloc((vtr*16) * sizeof(char));
00214                 memset(cfg_info->cfg_phasor_channels, '\0', sizeof(cfg_info->cfg_phasor_channels));     
00215 
00216                 for (ia=1; ia<vtr; ia++)
00217                 {       
00218                         /* Get the text entry value filled by user */
00219                         aa[ia] = gtk_entry_get_text(GTK_ENTRY(num_text[ia]));
00220 
00221                         if(strlen(aa[ia]) == 0)
00222                         {
00223                                 free (cfg_info->cfg_phasor_channels);
00224                                 display_msg = "\t\tPlease enter Phasor channel name\t\t\n";
00225                                 validation_result (display_msg);                /* Show the unsuccess message to user */
00226                                 return 1;
00227                         }                       
00228                         else
00229                         {
00230                                 memset(stn, '\0', 16);
00231                                 strcpy(stn, aa[ia]);
00232                                 j = strlen(stn);
00233                                 if(j < 17)
00234                                 {
00235                                         for(i = j; i < 16 ; i++)
00236                                         {
00237                                                 stn[i] =  c;
00238                                         }
00239                                 }
00240                         }
00241 
00242                         for (i=0; i< 16 && i< vtr*16; i++, ia1++) 
00243                         {
00244                                 /* Copy all phasor name in an array */
00245                                 cfg_info->cfg_phasor_channels[ia1] = stn[i]; 
00246                         }               
00247                 }
00248 
00249                 /* Close/destroy the PhasorChWin */
00250                 gtk_widget_destroy(PhasorChWin);                        
00251 
00252                 /* Next call for Enter Analog channels */
00253                 channel_names_for_analog ();
00254 
00255                 return 0;
00256         };

Here is the call graph for this function:

Here is the caller graph for this function:

int validation_remove_ph_an_num ( GtkButton *  but,
gpointer  udata 
)

Definition at line 619 of file CfgGuiFunctions.c.

References CCWin, ConfigurationFrame::cfg_annmr_val, cfg_info, ConfigurationFrame::cfg_phnmr_val, change_data_rate_option(), isNumber(), ConfigurationChange::new_cfg_annmr_val, new_cfg_info, ConfigurationChange::new_cfg_phnmr_val, phtext, remove_analog_num(), and validation_result().

Referenced by remove_analog_num(), and remove_phasor_num().

00620         {
00621                 /* local variables */
00622                 const char *text;
00623                 char *display_msg, find_butn[2];
00624 
00625                 /* Get the text entry value filled by user */
00626                 text  = gtk_entry_get_text(GTK_ENTRY(phtext));
00627                 strcpy(find_butn,(char *) udata);
00628 
00629                 if(isNumber((char *)text))      /* Check text_box entry for valid integer or not?  */
00630                 {
00631                         if(!strcmp(find_butn, "1") && atoi(text) < cfg_info->cfg_phnmr_val )    /* Atleast one phasor should be present there in CFG Frame */
00632                         {
00633                                 /* If Phasor removal? */
00634                                 new_cfg_info->new_cfg_phnmr_val = atoi(text); 
00635 
00636                                 /* Next call to remove */
00637                                 remove_analog_num ();
00638 
00639                                 return 0;
00640                         }
00641                         else if(!strcmp(find_butn, "2") && atoi(text) <= cfg_info->cfg_annmr_val )
00642                         {
00643                                 /* If Analog removal? */
00644                                 new_cfg_info->new_cfg_annmr_val = atoi(text); 
00645 
00646                                 /* Close/destroy the CCWin */
00647                                 gtk_widget_destroy(CCWin);
00648 
00649                                 change_data_rate_option();
00650 
00651                                 return 0;
00652                         }
00653                         else
00654                         {
00655                                 display_msg = "\t\tPlease enter value within max range!\t\t\n";
00656                                 validation_result (display_msg);        /* Show the unsuccess message to user */
00657                                 return 1;
00658                         }
00659                 }
00660                 else
00661                 {
00662                         display_msg = "\t\tPlease enter valid value in the field\t\t\n";
00663                         validation_result (display_msg);        /* Show the unsuccess message to user */
00664                         return 1;
00665                 }
00666         };

Here is the call graph for this function:

Here is the caller graph for this function:

Generated on Tue Jun 7 13:43:29 2011 for PMUSimulator by  doxygen 1.6.3