Commit e945762c by karudu

Nimeta salvestamine, koodi korda tegemine

parent f1a3efb5
#include <gtk/gtk.h>
#ifdef SOURCEVIEW
#include <gtksourceview/gtksource.h>
#endif
#include "ceditor.h"
/* TODO
Nimeta salvestamine
Klahvikombinatsioonid
*/
#ifdef SOURCEVIEW
#define PEALKIRI "CEditor SourceView"
#else
#define PEALKIRI "CEditor TextView"
#endif
// Uuenda näidatud rida ja veergu kursori asukoha järgi
void UuendaRidaVeerg(GtkTextBuffer *Puhver, GtkStatusbar *StatusBar)
{
GtkTextIter Iter;
// Leia kursori asukoht
gtk_text_buffer_get_iter_at_mark(Puhver, &Iter, gtk_text_buffer_get_insert(Puhver));
// Võta selle rida ja veerg
gint Rida = gtk_text_iter_get_line(&Iter);
gint Veerg = gtk_text_iter_get_line_offset(&Iter);
gtk_statusbar_pop(StatusBar, 0); // Võta eelmine tekst ära
gchar *Tekst = g_strdup_printf("%d:%d", Rida + 1, Veerg + 1); // Loo string rea ja veeruga
gtk_statusbar_push(StatusBar, 0, Tekst); // Näita teksti
g_free(Tekst);
}
// Kutsutakse copy/paste lohistamise korral, praegu lihtsalt uuendab rida/veergu
void TekstMarkSet(GtkTextBuffer *Puhver, const GtkTextIter *new_location, GtkTextMark *Mark, gpointer Data)
{
UuendaRidaVeerg(Puhver, GTK_STATUSBAR(Data));
}
void UusFail(GtkWidget *Nupp, gpointer Data)
{
GtkTextBuffer *Puhver = GTK_TEXT_BUFFER(Data);
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gtk_text_buffer_delete(Puhver, &TekstA, &TekstL);
gtk_text_buffer_set_modified(Puhver, FALSE);
}
void AvaFail(GtkWidget *Nupp, gpointer Data)
{
GtkTextBuffer *Puhver = GTK_TEXT_BUFFER(Data);
GtkWidget *Dialog = gtk_file_chooser_dialog_new("Ava fail", NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
"Tühista", GTK_RESPONSE_CANCEL,
"Ava", GTK_RESPONSE_ACCEPT, NULL);
gint Vastus = gtk_dialog_run(GTK_DIALOG(Dialog));
if(Vastus == GTK_RESPONSE_ACCEPT)
{
char *Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
gchar *Sisu;
GError *Viga = NULL;
// TODO paremad veateated
if(g_file_get_contents(Nimi, &Sisu, NULL, &Viga))
{
if(g_utf8_validate(Sisu, -1, NULL))
{
gtk_text_buffer_set_text(Puhver, Sisu, -1);
} else printf("g_utf8_validate viga\n");
g_free(Sisu);
}
else
{
printf("Viga faili avamisel: %s\n", Viga->message);
g_error_free(Viga);
}
g_free(Nimi);
}
gtk_widget_destroy(Dialog);
}
void SalvestaFail(GtkWidget *Nupp, gpointer Data)
{
GtkTextBuffer *Puhver = GTK_TEXT_BUFFER(Data);
GtkWidget *Dialog = gtk_file_chooser_dialog_new("Salvesta fail", NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
"Tühista", GTK_RESPONSE_CANCEL,
"Salvesta", GTK_RESPONSE_ACCEPT, NULL);
gint Vastus = gtk_dialog_run(GTK_DIALOG(Dialog));
if(Vastus == GTK_RESPONSE_ACCEPT)
{
char *Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gchar *Sisu = gtk_text_buffer_get_text(Puhver, &TekstA, &TekstL, TRUE);
gtk_text_buffer_set_modified(Puhver, FALSE);
GError *Viga = NULL;
if(g_file_set_contents(Nimi, Sisu, -1, &Viga) == FALSE)
{
printf("Viga faili salvestamisel: %s\n", Viga->message);
g_error_free(Viga);
}
g_free(Nimi);
g_free(Sisu);
}
gtk_widget_destroy(Dialog);
}
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
// Aken
GtkWidget *Aken = gtk_window_new(GTK_WINDOW_TOPLEVEL); // Loo aken
gtk_window_set_position(GTK_WINDOW(Aken), GTK_WIN_POS_CENTER); // Aken ekraani keskel
gtk_window_set_default_size(GTK_WINDOW(Aken), 800, 600); // Akna suurus
gtk_window_set_title(GTK_WINDOW(Aken), PEALKIRI); // Pealkiri
// Close nupu callback
g_signal_connect_swapped(G_OBJECT(Aken), "destroy", G_CALLBACK(gtk_main_quit), NULL);
// Box
GtkWidget *Box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); // Vertikaalne box, 0px vahe
gtk_container_add(GTK_CONTAINER(Aken), Box); // Pane box aknasse
// Tekstiaken
#ifdef SOURCEVIEW
GtkWidget *View = gtk_source_view_new(); // Loo tekstiaken
#else
GtkWidget *View = gtk_text_view_new(); // Loo tekstiaken
#endif
// Teksti puhver
GtkTextBuffer *Puhver = gtk_text_view_get_buffer(GTK_TEXT_VIEW(View)); // Tekstiakna teksti puhver
GtkWidget *ScrollWindow = gtk_scrolled_window_new(NULL, NULL); //tekitame scrollitava akna
gtk_container_add(GTK_CONTAINER(ScrollWindow), View); //paigutame tesktiakna scrollitavasse aknasse
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ScrollWindow), GTK_SHADOW_ETCHED_IN);
// Menu bar
GtkWidget *MenuBar = gtk_menu_bar_new(); // Loo menu bar
GtkWidget *FailMenuNupp = gtk_menu_item_new_with_label("Fail"); // Fail
GtkWidget *AboutMenuNupp = gtk_menu_item_new_with_label("About"); // About
GtkWidget *FailMenu = gtk_menu_new(); // Fail menüü
GtkWidget *FailMenuUus = gtk_menu_item_new_with_label("Uus"); // Fail->Uus
GtkWidget *FailMenuAva = gtk_menu_item_new_with_label("Ava"); // Fail->Ava
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 *FailMenuValju = gtk_menu_item_new_with_label("Välju"); // Fail->Välju
// Menüü nupud menu bar'i
gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), FailMenuNupp);
gtk_menu_shell_append(GTK_MENU_SHELL(MenuBar), AboutMenuNupp);
// Menüüd nuppudesse
gtk_menu_item_set_submenu(GTK_MENU_ITEM(FailMenuNupp), FailMenu);
// Fail menüü
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuUus); // Fail->Uus
g_signal_connect(FailMenuUus, "activate", G_CALLBACK(UusFail), Puhver);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuAva); // Fail->Ava
g_signal_connect(FailMenuAva, "activate", G_CALLBACK(AvaFail), Puhver);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvesta); // Fail->Salvesta
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvestaN); // Fail->Salvesta nimega
g_signal_connect(FailMenuSalvestaN, "activate", G_CALLBACK(SalvestaFail), Puhver);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuValju); // Fail->Välju
g_signal_connect(FailMenuValju, "activate", G_CALLBACK(gtk_main_quit), NULL);
// Pane menubar box'i
gtk_box_pack_start(GTK_BOX(Box), MenuBar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(Box), ScrollWindow, TRUE, TRUE, 0); // Pane tekstiaken box'i
// Status bar
GtkWidget *StatusBar = gtk_statusbar_new(); // Loo status bar
gtk_box_pack_start(GTK_BOX(Box), StatusBar, FALSE, FALSE, 0); // Pane statusbar box'i
// Teksti muutuse callback, uuendab rida/veergu
g_signal_connect(Puhver, "changed", G_CALLBACK(UuendaRidaVeerg), StatusBar);
// Copy/paste lohistamise callback, uuendab samuti
g_signal_connect_object(Puhver, "mark_set", G_CALLBACK(TekstMarkSet), StatusBar, 0);
gtk_widget_show_all(Aken); // Näita akent
UuendaRidaVeerg(Puhver, GTK_STATUSBAR(StatusBar)); // Esimene uuendus
ui *UI = LooUI();
gtk_widget_show_all(UI->Aken); // Näita akent
gtk_main();
......
#ifndef CEDITOR_H
#define CEDITOR_H
#include <gtk/gtk.h>
#include "ui.h"
#ifdef SOURCEVIEW
#include <gtksourceview/gtksource.h>
#endif
#endif // CEDITOR_H
#include "saveload.h"
void UusFail(GtkWidget *Nupp, gpointer Data)
{
// TODO praeguse faili salvestamise prompt
tab *Tab = (tab *)Data;
GtkTextBuffer *Puhver = Tab->Puhver;
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gtk_text_buffer_delete(Puhver, &TekstA, &TekstL);
gtk_text_buffer_set_modified(Puhver, FALSE);
if(Tab->FailiNimi) g_free(Tab->FailiNimi);
Tab->FailiNimi = 0;
UuendaPealkirja(Tab->Aken, 0);
}
void AvaFail(GtkWidget *Nupp, gpointer Data)
{
tab *Tab = (tab *)Data;
GtkTextBuffer *Puhver = Tab->Puhver;
GtkWidget *Dialog = gtk_file_chooser_dialog_new("Ava fail", NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
"Tühista", GTK_RESPONSE_CANCEL,
"Ava", GTK_RESPONSE_ACCEPT, NULL);
gint Vastus = gtk_dialog_run(GTK_DIALOG(Dialog));
if(Vastus == GTK_RESPONSE_ACCEPT)
{
char *Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
gchar *Sisu;
GError *Viga = NULL;
// TODO paremad veateated
if(g_file_get_contents(Nimi, &Sisu, NULL, &Viga))
{
if(g_utf8_validate(Sisu, -1, NULL))
{
gtk_text_buffer_set_text(Puhver, Sisu, -1);
Tab->FailiNimi = Nimi;
UuendaPealkirja(Tab->Aken, Nimi);
}
else
{
printf("g_utf8_validate viga\n");
g_free(Nimi);
}
g_free(Sisu);
}
else
{
printf("Viga faili avamisel: %s\n", Viga->message);
g_error_free(Viga);
g_free(Nimi);
}
}
gtk_widget_destroy(Dialog);
}
void SalvestaFail(GtkWidget *Nupp, gpointer Data)
{
tab *Tab = (tab *)Data;
GtkTextBuffer *Puhver = Tab->Puhver;
char *Nimi;
GtkWidget *Dialog = 0;
if(Tab->FailiNimi) // Fail on juba olemas
{
Nimi = Tab->FailiNimi;
}
else // Salvestame uue faili
{
Dialog = gtk_file_chooser_dialog_new("Salvesta fail", NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
"Tühista", GTK_RESPONSE_CANCEL,
"Salvesta", GTK_RESPONSE_ACCEPT, NULL);
gint Vastus = gtk_dialog_run(GTK_DIALOG(Dialog));
if(Vastus == GTK_RESPONSE_ACCEPT)
{
Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
}
else
{
gtk_widget_destroy(Dialog);
return;
}
}
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gchar *Sisu = gtk_text_buffer_get_text(Puhver, &TekstA, &TekstL, TRUE);
gtk_text_buffer_set_modified(Puhver, FALSE);
GError *Viga = NULL;
if(g_file_set_contents(Nimi, Sisu, -1, &Viga) == FALSE)
{
printf("Viga faili salvestamisel: %s\n", Viga->message);
g_error_free(Viga);
}
// Kui enne salvestamist failinime polńud, siis kasuta praegust
if(!Tab->FailiNimi)
{
Tab->FailiNimi = Nimi;
UuendaPealkirja(Tab->Aken, Nimi);
}
else g_free(Nimi);
g_free(Sisu);
if(Dialog) gtk_widget_destroy(Dialog);
}
void SalvestaFailNimega(GtkWidget *Nupp, gpointer Data)
{
tab *Tab = (tab *)Data;
GtkTextBuffer *Puhver = Tab->Puhver;
GtkWidget *Dialog = gtk_file_chooser_dialog_new("Salvesta fail", NULL, GTK_FILE_CHOOSER_ACTION_SAVE,
"Tühista", GTK_RESPONSE_CANCEL,
"Salvesta", GTK_RESPONSE_ACCEPT, NULL);
gint Vastus = gtk_dialog_run(GTK_DIALOG(Dialog));
if(Vastus == GTK_RESPONSE_ACCEPT)
{
char *Nimi = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(Dialog));
GtkTextIter TekstA, TekstL;
gtk_text_buffer_get_start_iter(Puhver, &TekstA);
gtk_text_buffer_get_end_iter(Puhver, &TekstL);
gchar *Sisu = gtk_text_buffer_get_text(Puhver, &TekstA, &TekstL, TRUE);
gtk_text_buffer_set_modified(Puhver, FALSE);
GError *Viga = NULL;
if(g_file_set_contents(Nimi, Sisu, -1, &Viga) == FALSE)
{
printf("Viga faili salvestamisel: %s\n", Viga->message);
g_error_free(Viga);
}
// Kui enne salvestamist failinime polńud, siis kasuta praegust
if(!Tab->FailiNimi)
{
Tab->FailiNimi = Nimi;
UuendaPealkirja(Tab->Aken, Nimi);
}
else g_free(Nimi);
g_free(Sisu);
}
gtk_widget_destroy(Dialog);
}
#ifndef SAVELOAD_H
#define SAVELOAD_H
#include "ceditor.h"
void UusFail(GtkWidget *Nupp, gpointer Data);
void AvaFail(GtkWidget *Nupp, gpointer Data);
void SalvestaFail(GtkWidget *Nupp, gpointer Data);
void SalvestaFailNimega(GtkWidget *Nupp, gpointer Data);
#endif // SAVELOAD_H
#include "statusbar.h"
// Uuenda näidatud rida ja veergu kursori asukoha järgi
void UuendaRidaVeerg(GtkTextBuffer *Puhver, GtkStatusbar *StatusBar)
{
GtkTextIter Iter;
// Leia kursori asukoht
gtk_text_buffer_get_iter_at_mark(Puhver, &Iter, gtk_text_buffer_get_insert(Puhver));
// Võta selle rida ja veerg
gint Rida = gtk_text_iter_get_line(&Iter);
gint Veerg = gtk_text_iter_get_line_offset(&Iter);
gtk_statusbar_pop(StatusBar, 0); // Võta eelmine tekst ära
gchar *Tekst = g_strdup_printf("%d:%d", Rida + 1, Veerg + 1); // Loo string rea ja veeruga
gtk_statusbar_push(StatusBar, 0, Tekst); // Näita teksti
g_free(Tekst);
}
#ifndef STATUSBAR_H
#define STATUSBAR_H
#include "ceditor.h"
void UuendaRidaVeerg(GtkTextBuffer *Puhver, GtkStatusbar *StatusBar);
#endif // STATUSBAR_H
#include "textview.h"
// Kutsutakse copy/paste lohistamise korral, praegu lihtsalt uuendab rida/veergu
void TekstMarkSet(GtkTextBuffer *Puhver, const GtkTextIter *new_location, GtkTextMark *Mark, gpointer Data)
{
UuendaRidaVeerg(Puhver, GTK_STATUSBAR(Data));
}
#ifndef TEXTVIEW_H
#define TEXTVIEW_H
#include "ceditor.h"
void TekstMarkSet(GtkTextBuffer *Puhver, const GtkTextIter *new_location, GtkTextMark *Mark, gpointer Data);
#endif // TEXTVIEW_H
#include "ui.h"
// Uuenda akna pealkirjas näidatud failinime
void UuendaPealkirja(GtkWidget *Aken, char *Nimi)
{
if(Nimi)
{
char *Pealkiri = g_strdup_printf("%s (%s)", PEALKIRI, Nimi);
gtk_window_set_title(GTK_WINDOW(Aken), Pealkiri);
g_free(Pealkiri);
}
else
{
char *Pealkiri = g_strdup_printf("%s (uus fail)", PEALKIRI);
gtk_window_set_title(GTK_WINDOW(Aken), Pealkiri);
g_free(Pealkiri);
}
}
// Loo programmi kasutajaliides
ui *LooUI()
{
ui *UI = g_malloc(sizeof(ui));
// Aken
UI->Aken = gtk_window_new(GTK_WINDOW_TOPLEVEL); // Loo aken
gtk_window_set_position(GTK_WINDOW(UI->Aken), GTK_WIN_POS_CENTER); // Aken ekraani keskel
gtk_window_set_default_size(GTK_WINDOW(UI->Aken), 800, 600); // Akna suurus
UuendaPealkirja(UI->Aken, 0); // Pealkiri
g_signal_connect_swapped(G_OBJECT(UI->Aken), "destroy", G_CALLBACK(gtk_main_quit), NULL); // Close nupu callback
// Box
UI->Box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); // Vertikaalne box, 0px vahe
gtk_container_add(GTK_CONTAINER(UI->Aken), UI->Box); // Pane box aknasse
// Tekstiaken
#ifdef SOURCEVIEW
UI->TextView = gtk_source_view_new(); // Loo tekstiaken
#else
UI->TextView = gtk_text_view_new(); // Loo tekstiaken
#endif
// Praegu ainult üks "tab"
UI->Tabid = g_malloc(sizeof(tab) * 1);
UI->TabidN = 0;
UI->Tabid[0].FailiNimi = 0; // Faili veel pole
UI->Tabid[0].Aken = UI->Aken;
// Teksti puhver
UI->Tabid[0].Puhver = gtk_text_view_get_buffer(GTK_TEXT_VIEW(UI->TextView)); // Tekstiakna teksti puhver
// Scroll window
UI->ScrollWindow = gtk_scrolled_window_new(NULL, NULL); // Loo scroll aken
gtk_container_add(GTK_CONTAINER(UI->ScrollWindow), UI->TextView); // Scroll aknasse läheb tekstiaken
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(UI->ScrollWindow), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); // Konfigureerimine
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(UI->ScrollWindow), GTK_SHADOW_ETCHED_IN);
// Menu bar
UI->MenuBar = gtk_menu_bar_new(); // Loo menu bar
GtkWidget *FailMenuNupp = gtk_menu_item_new_with_label("Fail"); // Fail
GtkWidget *AboutMenuNupp = gtk_menu_item_new_with_label("About"); // About
GtkWidget *FailMenu = gtk_menu_new(); // Fail menüü
GtkWidget *FailMenuUus = gtk_menu_item_new_with_label("Uus"); // Fail->Uus
GtkWidget *FailMenuAva = gtk_menu_item_new_with_label("Ava"); // Fail->Ava
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 *FailMenuValju = gtk_menu_item_new_with_label("Välju"); // Fail->Välju
// Menüü nupud menu bar'i
gtk_menu_shell_append(GTK_MENU_SHELL(UI->MenuBar), FailMenuNupp);
gtk_menu_shell_append(GTK_MENU_SHELL(UI->MenuBar), AboutMenuNupp);
// Menüüd nuppudesse
gtk_menu_item_set_submenu(GTK_MENU_ITEM(FailMenuNupp), FailMenu);
// Fail menüü
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuUus); // Fail->Uus
g_signal_connect(FailMenuUus, "activate", G_CALLBACK(UusFail), &UI->Tabid[0]);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuAva); // Fail->Ava
g_signal_connect(FailMenuAva, "activate", G_CALLBACK(AvaFail), &UI->Tabid[0]);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvesta); // Fail->Salvesta
g_signal_connect(FailMenuSalvesta, "activate", G_CALLBACK(SalvestaFail), &UI->Tabid[0]);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuSalvestaN); // Fail->Salvesta nimega
g_signal_connect(FailMenuSalvestaN, "activate", G_CALLBACK(SalvestaFailNimega), &UI->Tabid[0]);
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(FailMenu), FailMenuValju); // Fail->Välju
g_signal_connect(FailMenuValju, "activate", G_CALLBACK(gtk_main_quit), NULL);
// Status bar
UI->StatusBar = gtk_statusbar_new(); // Loo status bar
// Teksti muutuse callback, uuendab rida/veergu
g_signal_connect(UI->Tabid[0].Puhver, "changed", G_CALLBACK(UuendaRidaVeerg), UI->StatusBar);
// Copy/paste lohistamise callback, uuendab samuti
g_signal_connect_object(UI->Tabid[0].Puhver, "mark_set", G_CALLBACK(TekstMarkSet), UI->StatusBar, 0);
// Pane kõik õiges järjekorras box'i
gtk_box_pack_start(GTK_BOX(UI->Box), UI->MenuBar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(UI->Box), UI->ScrollWindow, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(UI->Box), UI->StatusBar, FALSE, FALSE, 0);
UuendaRidaVeerg(UI->Tabid[0].Puhver, GTK_STATUSBAR(UI->StatusBar)); // Uuenda status bar'i, et seal midagi oleks
return UI;
}
#ifndef UI_H
#define UI_H
#include "ceditor.h"
#include "saveload.h"
#include "textview.h"
#include "statusbar.h"
#ifdef SOURCEVIEW
#define PEALKIRI "CEditor SourceView"
#else
#define PEALKIRI "CEditor TextView"
#endif
typedef struct
{
GtkWidget *Aken; // Programmi aken
char *FailiNimi; // Viit faili nimele, 0 kui nime veel pole
GtkTextBuffer *Puhver; // Vahekaardi tekstipuhver
} tab;
typedef struct
{
GtkWidget *Aken; // Programmi aken
GtkWidget *Box; // Akna box
GtkWidget *MenuBar; // Ülaosa menüü
GtkWidget *TextView; // Tekstiaken
GtkWidget *ScrollWindow; // Tekstiakna scroll
GtkWidget *StatusBar; // Status bar allpool
tab *Tabid; // Vahekaartide massiiv
int TabidN; // Mitu vahekaarti on avatud
} ui;
ui *LooUI();
#endif // UI_H
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