Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
karudu
/
C-editor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
607fda03
authored
Mar 23, 2022
by
Herman Ounas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lisatud reanumbrid ja toolbar.
parent
30a0b72b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
2 deletions
.gitignore
ceditor.h
tab.c
ui.c
.gitignore
0 → 100644
View file @
607fda03
ceditor
ceditor.h
View file @
607fda03
#ifndef CEDITOR_H
#define CEDITOR_H
#define SOURCEVIEW
#include <gtk/gtk.h>
#ifdef SOURCEVIEW
...
...
@@ -25,6 +27,7 @@ typedef struct
GtkWidget
*
Box
;
// Akna box
GtkWidget
*
MenuBar
;
// Ülaosa menüü
GtkWidget
*
Notebook
;
// Notebook vahekaartidega
GtkWidget
*
ToolBar
;
//Tool bar
// Viited nuppudele nende sisse/välja lülitamiseks
GtkWidget
*
FailMenuAva
;
...
...
@@ -35,6 +38,10 @@ typedef struct
tab
*
Tabid
;
// Vahekaartide massiiv
int
PraeguneTab
;
// Praegune valitud vahekaart
int
TabidN
;
// Mitu vahekaarti on avatud
//toolbari nupud
GtkToolItem
*
Undo
;
//undo nupp
GtkToolItem
*
Redo
;
//redo nupp
}
ui
;
#endif // CEDITOR_H
tab.c
View file @
607fda03
...
...
@@ -32,7 +32,6 @@ void LisaTab(ui *UI)
gtk_container_add
(
GTK_CONTAINER
(
Tab
->
ScrollWindow
),
Tab
->
TextView
);
// Scroll aknasse läheb tekstiaken
gtk_scrolled_window_set_policy
(
GTK_SCROLLED_WINDOW
(
Tab
->
ScrollWindow
),
GTK_POLICY_AUTOMATIC
,
GTK_POLICY_AUTOMATIC
);
// Konfigureerimine
gtk_scrolled_window_set_shadow_type
(
GTK_SCROLLED_WINDOW
(
Tab
->
ScrollWindow
),
GTK_SHADOW_ETCHED_IN
);
// Status bar
Tab
->
StatusBar
=
gtk_statusbar_new
();
// Teksti muutuse callback, uuendab rida/veergu
...
...
@@ -53,6 +52,8 @@ void LisaTab(ui *UI)
gtk_widget_show_all
(
UI
->
Notebook
);
// Värskenda, et näha oleks
UuendaRidaVeerg
(
GTK_TEXT_BUFFER
(
Tab
->
Puhver
),
GTK_STATUSBAR
(
Tab
->
StatusBar
));
// Uuenda status bar'i, et seal midagi oleks
gtk_source_view_set_show_line_numbers
(
GTK_SOURCE_VIEW
(
Tab
->
TextView
),
TRUE
);
//naita reanumbrid
}
// Kustuta vahekaarti indeksil
...
...
@@ -60,7 +61,6 @@ void KustutaTab(ui *UI, int Indeks)
{
// Kustuta vahekaart
gtk_notebook_remove_page
(
GTK_NOTEBOOK
(
UI
->
Notebook
),
Indeks
);
int
TabidN
=
UI
->
TabidN
;
// Kui massiivis on pärast kustutatud vahekaarti neid veel,
// siis nihuta need õigele kohale
...
...
ui.c
View file @
607fda03
...
...
@@ -100,8 +100,22 @@ ui *LooUI()
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
FailMenu
),
FailMenuValju
);
// Fail->Välju
g_signal_connect
(
FailMenuValju
,
"activate"
,
G_CALLBACK
(
Valju
),
UI
);
//ToolBar
UI
->
ToolBar
=
gtk_toolbar_new
();
gtk_toolbar_set_style
(
GTK_TOOLBAR
(
UI
->
ToolBar
),
GTK_TOOLBAR_ICONS
);
GtkWidget
*
UndoIcon
=
gtk_image_new_from_icon_name
(
GTK_STOCK_UNDO
,
5
);
UI
->
Undo
=
gtk_tool_button_new
(
UndoIcon
,
"undo"
);
GtkWidget
*
RedoIcon
=
gtk_image_new_from_icon_name
(
GTK_STOCK_REDO
,
5
);
UI
->
Redo
=
gtk_tool_button_new
(
RedoIcon
,
"redo"
);
//nupud toolbarile
gtk_toolbar_insert
(
GTK_TOOLBAR
(
UI
->
ToolBar
),
UI
->
Undo
,
-
1
);
gtk_toolbar_insert
(
GTK_TOOLBAR
(
UI
->
ToolBar
),
UI
->
Redo
,
-
1
);
// 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
->
ToolBar
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
UI
->
Box
),
UI
->
Notebook
,
TRUE
,
TRUE
,
0
);
return
UI
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment