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
39c7e92d
authored
Apr 20, 2022
by
Herman Ounas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheme Chooser Widget lisatud
parent
c0347650
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
2 deletions
ceditor.h
custom.c
custom.h
tab.c
ui.c
ui.h
ceditor.h
View file @
39c7e92d
...
...
@@ -48,6 +48,11 @@ typedef struct
GtkToolItem
*
Undo
;
//undo nupp
GtkToolItem
*
Redo
;
//redo nupp
//Stiili asjad
GtkSourceStyleSchemeManager
*
SchemeManager
;
GtkSourceStyleScheme
*
Scheme
;
GtkSourceStyleSchemeChooser
*
SchemeChooser
;
GKeyFile
*
Seaded
;
// Seadete fail
char
*
SeadedNimi
;
// Seadete faili nimi
}
ui
;
...
...
custom.c
0 → 100644
View file @
39c7e92d
#include "custom.h"
void
Chooser
(
GtkWidget
*
Nupp
,
gpointer
Data
){
ui
*
UI
=
(
ui
*
)
Data
;
GtkWindow
*
Aken
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
gtk_window_set_default_size
(
Aken
,
300
,
100
);
gtk_window_set_title
(
Aken
,
"Isikuparastamine"
);
GtkBox
*
box
=
gtk_box_new
(
GTK_ORIENTATION_VERTICAL
,
0
);
gtk_container_add
(
GTK_CONTAINER
(
Aken
),
box
);
GtkWidget
*
ChooserButton
=
gtk_source_style_scheme_chooser_button_new
();
UI
->
SchemeChooser
=
ChooserButton
;
gtk_widget_set_size_request
(
ChooserButton
,
150
,
100
);
GtkWidget
*
ApplyButton
=
gtk_button_new_with_label
(
"Apply"
);
gtk_box_pack_start
(
box
,
GTK_WIDGET
(
ApplyButton
),
FALSE
,
FALSE
,
0
);
gtk_widget_set_size_request
(
ApplyButton
,
150
,
50
);
gtk_box_pack_start
(
box
,
GTK_WIDGET
(
ChooserButton
),
FALSE
,
FALSE
,
0
);
g_signal_connect
(
ApplyButton
,
"clicked"
,
G_CALLBACK
(
SetStyle
),
UI
);
gtk_widget_show_all
(
Aken
);
}
void
SetStyle
(
GtkWidget
*
nupp
,
gpointer
Data
){
ui
*
UI
=
(
ui
*
)
Data
;
UI
->
Scheme
=
gtk_source_style_scheme_chooser_get_style_scheme
(
UI
->
SchemeChooser
);
gtk_source_style_scheme_chooser_set_style_scheme
(
UI
->
SchemeChooser
,
UI
->
Scheme
);
}
custom.h
0 → 100644
View file @
39c7e92d
#ifndef CUSTOM_H
#define CUSTOM_H
#include "ceditor.h"
void
Chooser
(
GtkWidget
*
Nupp
,
gpointer
Data
);
void
SetStyle
(
GtkWidget
*
Nupp
,
gpointer
Data
);
#endif // CUSTOM_H
tab.c
View file @
39c7e92d
...
...
@@ -69,6 +69,8 @@ void LisaTab(ui *UI)
Tab
->
Language
=
gtk_source_language_manager_get_language
(
Tab
->
LangManager
,
"c"
);
gtk_source_buffer_set_language
(
Tab
->
Puhver
,
Tab
->
Language
);
// gtk_source_buffer_set_style_scheme(Tab->Puhver, UI->Scheme);
// Lisa loodud tab notebook'i
gtk_notebook_append_page
(
GTK_NOTEBOOK
(
UI
->
Notebook
),
Tab
->
Box
,
Tab
->
Pealkiri
);
gtk_widget_show_all
(
UI
->
Notebook
);
// Värskenda, et näha oleks
...
...
ui.c
View file @
39c7e92d
...
...
@@ -58,6 +58,8 @@ ui *LooUI()
gtk_window_set_title
(
GTK_WINDOW
(
UI
->
Aken
),
PEALKIRI
);
// Pealkiri
g_signal_connect
(
UI
->
Aken
,
"delete-event"
,
G_CALLBACK
(
SulgeAken
),
UI
);
// Close nupu callback
UI
->
SchemeManager
=
gtk_source_style_scheme_manager_get_default
();
// 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
...
...
@@ -96,13 +98,20 @@ ui *LooUI()
GtkWidget
*
KompMenuSeaded
=
gtk_menu_item_new_with_label
(
"Seaded"
);
// Kompileeri->Seaded
GtkWidget
*
KompMenuKompileeri
=
gtk_menu_item_new_with_label
(
"Kompileeri"
);
// Kompileeri->Kompileeri
GtkWidget
*
KompMenuKaivita
=
gtk_menu_item_new_with_label
(
"Käivita programm"
);
// Kompileeri->Käivita programm
//isikuparastamise menuu
GtkWidget
*
IsikupMenu
=
gtk_menu_new
();
GtkWidget
*
IsikupMenuNupp
=
gtk_menu_item_new_with_label
(
"Isikupärastamine"
);
GtkWidget
*
IsikupSeadedNupp
=
gtk_menu_item_new_with_label
(
"Seaded"
);
// Menüü nupud menu bar'i
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
UI
->
MenuBar
),
FailMenuNupp
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
UI
->
MenuBar
),
KompMenuNupp
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
UI
->
MenuBar
),
IsikupMenuNupp
);
// Menüüd nuppudesse
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
FailMenuNupp
),
FailMenu
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
KompMenuNupp
),
KompMenu
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
IsikupMenuNupp
),
IsikupMenu
);
// Fail menüü
LisaMenuItem
(
UI
,
FailMenu
,
FailMenuUus
,
Uus
,
GDK_KEY_N
,
GDK_CONTROL_MASK
);
// Fail->Uus vahekaart
MenuSeparator
(
FailMenu
);
...
...
@@ -118,16 +127,16 @@ ui *LooUI()
MenuSeparator
(
KompMenu
);
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKompileeri
,
Kompileeri
,
GDK_KEY_C
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Kompileeri
LisaMenuItem
(
UI
,
KompMenu
,
KompMenuKaivita
,
KaivitaProgramm
,
GDK_KEY_R
,
GDK_CONTROL_MASK
|
GDK_SHIFT_MASK
);
// Kompileeri->Käivita programm
//Isikparastamise menuu
LisaMenuItem
(
UI
,
IsikupMenu
,
IsikupSeadedNupp
,
Chooser
,
0
,
0
);
//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
);
GtkWidget
*
RedoIcon
=
gtk_image_new_from_icon_name
(
GTK_STOCK_REDO
,
5
);
GtkWidget
*
SearchIcon
=
gtk_image_new_from_icon_name
(
GTK_STOCK_FIND
,
5
);
UI
->
Undo
=
gtk_tool_button_new
(
UndoIcon
,
"undo"
);
UI
->
Redo
=
gtk_tool_button_new
(
RedoIcon
,
"redo"
);
//g_signal_connect(UI->Search, "clicked", G_CALLBACK(search_aken), UI);
//nupud toolbarile
gtk_toolbar_insert
(
GTK_TOOLBAR
(
UI
->
ToolBar
),
UI
->
Undo
,
-
1
);
gtk_toolbar_insert
(
GTK_TOOLBAR
(
UI
->
ToolBar
),
UI
->
Redo
,
-
1
);
...
...
ui.h
View file @
39c7e92d
...
...
@@ -6,6 +6,7 @@
#include "menubar.h"
#include "compiler.h"
#include "search.h"
#include "custom.h"
#define PEALKIRI "CEditor"
...
...
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