Commit 3b41b73f by castro

Update main.c

parent 93ace83c
Showing with 11 additions and 11 deletions
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
#define PEALKIRI "CEditor TextView" #define PEALKIRI "CEditor TextView"
#endif #endif
// Uuenda nidatud rida ja veergu kursori asukoha jrgi // Uuenda nidatud rida ja veergu kursori asukoha jrgi
void UuendaRidaVeerg(GtkTextBuffer *Puhver, GtkStatusbar *StatusBar) void UuendaRidaVeerg(GtkTextBuffer *Puhver, GtkStatusbar *StatusBar)
{ {
GtkTextIter Iter; GtkTextIter Iter;
// Leia kursori asukoht // Leia kursori asukoht
gtk_text_buffer_get_iter_at_mark(Puhver, &Iter, gtk_text_buffer_get_insert(Puhver)); gtk_text_buffer_get_iter_at_mark(Puhver, &Iter, gtk_text_buffer_get_insert(Puhver));
// Vta selle rida ja veerg // Vta selle rida ja veerg
gint Rida = gtk_text_iter_get_line(&Iter); gint Rida = gtk_text_iter_get_line(&Iter);
gint Veerg = gtk_text_iter_get_line_offset(&Iter); gint Veerg = gtk_text_iter_get_line_offset(&Iter);
gtk_statusbar_pop(StatusBar, 0); // Vta eelmine tekst ra gtk_statusbar_pop(StatusBar, 0); // Vta eelmine tekst ra
gchar *Tekst = g_strdup_printf("%d:%d", Rida + 1, Veerg + 1); // Loo string rea ja veeruga gchar *Tekst = g_strdup_printf("%d:%d", Rida + 1, Veerg + 1); // Loo string rea ja veeruga
gtk_statusbar_push(StatusBar, 0, Tekst); // Nita teksti gtk_statusbar_push(StatusBar, 0, Tekst); // Nita teksti
g_free(Tekst); g_free(Tekst);
} }
...@@ -58,30 +58,30 @@ int main(int argc, char **argv) ...@@ -58,30 +58,30 @@ int main(int argc, char **argv)
GtkWidget *MenuBar = gtk_menu_bar_new(); // Loo menu bar GtkWidget *MenuBar = gtk_menu_bar_new(); // Loo menu bar
GtkWidget *FailMenuNupp = gtk_menu_item_new_with_label("Fail"); // Fail GtkWidget *FailMenuNupp = gtk_menu_item_new_with_label("Fail"); // Fail
GtkWidget *AboutMenuNupp = gtk_menu_item_new_with_label("About"); // About GtkWidget *AboutMenuNupp = gtk_menu_item_new_with_label("About"); // About
GtkWidget *FailMenu = gtk_menu_new(); // Fail men GtkWidget *FailMenu = gtk_menu_new(); // Fail men
GtkWidget *FailMenuUus = gtk_menu_item_new_with_label("Uus"); // Fail->Uus GtkWidget *FailMenuUus = gtk_menu_item_new_with_label("Uus"); // Fail->Uus
GtkWidget *FailMenuAva = gtk_menu_item_new_with_label("Ava"); // Fail->Ava GtkWidget *FailMenuAva = gtk_menu_item_new_with_label("Ava"); // Fail->Ava
GtkWidget *FailMenuSalvesta = gtk_menu_item_new_with_label("Salvesta"); // Fail->Salvesta GtkWidget *FailMenuSalvesta = gtk_menu_item_new_with_label("Salvesta"); // Fail->Salvesta
GtkWidget *FailMenuSalvestaN = gtk_menu_item_new_with_label("Salvesta nimega"); // Fail->Salvesta nimega GtkWidget *FailMenuSalvestaN = gtk_menu_item_new_with_label("Salvesta nimega"); // Fail->Salvesta nimega
GtkWidget *FailMenuValju = gtk_menu_item_new_with_label("Vlju"); // Fail->Vlju GtkWidget *FailMenuValju = gtk_menu_item_new_with_label("Vlju"); // Fail->Vlju
// Search // Search
GtkWidget *search_nupp = gtk_menu_item_new_with_label ("Otsi"); GtkWidget *search_nupp = gtk_menu_item_new_with_label ("Otsi");
GtkWidget *search_aken ; GtkWidget *search_aken ;
// Men nupud menu bar'i // Men nupud menu bar'i
gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), FailMenuNupp); gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), FailMenuNupp);
gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), AboutMenuNupp); gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), AboutMenuNupp);
gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), search_nupp); gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), search_nupp);
// Mend nuppudesse // Mend nuppudesse
gtk_menu_item_set_submenu(GTK_MENU_ITEM(FailMenuNupp), FailMenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(FailMenuNupp), FailMenu);
// Fail men // Fail men
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuUus); // Fail->Uus gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuUus); // Fail->Uus
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuAva); // Fail->Ava gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuAva); // Fail->Ava
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvesta); // Fail->Salvesta gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvesta); // Fail->Salvesta
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvestaN); // Fail->Salvesta nimega gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvestaN); // Fail->Salvesta nimega
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), gtk_separator_menu_item_new()); gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuValju); // Fail->Vlju gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuValju); // Fail->Vlju
g_signal_connect(G_OBJECT(FailMenuValju), "activate", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(FailMenuValju), "activate", G_CALLBACK(gtk_main_quit), NULL);
// Search // Search
...@@ -113,7 +113,7 @@ int main(int argc, char **argv) ...@@ -113,7 +113,7 @@ int main(int argc, char **argv)
// Copy/paste lohistamise callback, uuendab samuti // Copy/paste lohistamise callback, uuendab samuti
g_signal_connect_object(Puhver, "mark_set", G_CALLBACK(TekstMarkSet), StatusBar, 0); g_signal_connect_object(Puhver, "mark_set", G_CALLBACK(TekstMarkSet), StatusBar, 0);
gtk_widget_show_all(Aken); // Nita akent gtk_widget_show_all(Aken); // Nita akent
UuendaRidaVeerg(Puhver, GTK_STATUSBAR(StatusBar)); // Esimene uuendus UuendaRidaVeerg(Puhver, GTK_STATUSBAR(StatusBar)); // Esimene uuendus
gtk_main(); gtk_main();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment