feat: add css logging
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
BasedOnStyle: LLVM
|
BasedOnStyle: LLVM
|
||||||
ColumnLimit: 80
|
ColumnLimit: 80
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
IndentWidth: 2
|
IndentWidth: 4
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
0
src/application/applicationstate.c
Normal file
0
src/application/applicationstate.c
Normal file
7
src/application/applicationstate.h
Normal file
7
src/application/applicationstate.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
typedef enum VektorAppTool {
|
||||||
|
CircleTool
|
||||||
|
} VektorAppTool;
|
||||||
|
|
||||||
|
typedef struct VektorAppState {
|
||||||
|
VektorAppTool selectedTool;
|
||||||
|
} VektorAppState;
|
||||||
@@ -41,7 +41,7 @@ static void activate(GtkApplication *app, gpointer user_data) {
|
|||||||
|
|
||||||
VektorCanvas *canvas = (VektorCanvas *)malloc(sizeof(VektorCanvas));
|
VektorCanvas *canvas = (VektorCanvas *)malloc(sizeof(VektorCanvas));
|
||||||
vektor_canvas_init(widget_state, canvas);
|
vektor_canvas_init(widget_state, canvas);
|
||||||
vektor_canvas_fill(canvas, vektor_color_new(255,0,0,255));
|
vektor_canvas_fill(canvas, vektor_color_new(0,0,0,255));
|
||||||
vektor_framebuffer_drawto(&fb, canvas);
|
vektor_framebuffer_drawto(&fb, canvas);
|
||||||
vektor_canvas_update(canvas);
|
vektor_canvas_update(canvas);
|
||||||
|
|
||||||
@@ -52,7 +52,6 @@ static void activate(GtkApplication *app, gpointer user_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
//write_ppm("out.ppm", &fb);
|
|
||||||
|
|
||||||
GtkApplication *app;
|
GtkApplication *app;
|
||||||
int status;
|
int status;
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
#include "uicontroller.h"
|
#include "uicontroller.h"
|
||||||
|
#include "gdk/gdk.h"
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
|
#include "gtk/gtkcssprovider.h"
|
||||||
|
|
||||||
void vektor_uictrl_init(GtkApplication *app, VektorWidgetState *stateOut) {
|
void vektor_uictrl_init(GtkApplication *app, VektorWidgetState *stateOut) {
|
||||||
GtkBuilder *builder = gtk_builder_new();
|
GtkBuilder *builder = gtk_builder_new();
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_print("%s\n", g_get_current_dir());
|
|
||||||
|
|
||||||
// TODO: .ui files as resources instead of sketchy relative paths
|
// TODO: .ui files as resources instead of sketchy relative paths
|
||||||
if (!gtk_builder_add_from_file(builder, "./ui/main.ui", &error)) {
|
if (!gtk_builder_add_from_file(builder, "./ui/main.ui", &error)) {
|
||||||
g_error("Fatal: %s", error->message);
|
g_error("Fatal: %s", error->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkCssProvider* provider = gtk_css_provider_new();
|
||||||
|
gtk_css_provider_load_from_path(provider, "./ui/main.css");
|
||||||
|
gtk_style_context_add_provider_for_display(gdk_display_get_default(),
|
||||||
|
GTK_STYLE_PROVIDER(provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||||
|
);
|
||||||
|
|
||||||
stateOut->window = GTK_WINDOW(gtk_builder_get_object(builder, "main_window"));
|
stateOut->window = GTK_WINDOW(gtk_builder_get_object(builder, "main_window"));
|
||||||
stateOut->workspacePaned =
|
stateOut->workspacePaned =
|
||||||
GTK_PANED(gtk_builder_get_object(builder, "workspace_paned"));
|
GTK_PANED(gtk_builder_get_object(builder, "workspace_paned"));
|
||||||
|
|||||||
9
ui/main.css
Executable file
9
ui/main.css
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#toolstrip {
|
||||||
|
background: rgba(0,0,0,.6);
|
||||||
|
padding: 6px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
40
ui/main.ui
40
ui/main.ui
@@ -38,16 +38,52 @@
|
|||||||
<property name="vexpand">true</property>
|
<property name="vexpand">true</property>
|
||||||
<property name="wide-handle">true</property>
|
<property name="wide-handle">true</property>
|
||||||
|
|
||||||
<!--Main viewport area-->
|
|
||||||
|
<child>
|
||||||
|
<!--Overlay to hold tool selector and canvas-->
|
||||||
|
<object class="GtkOverlay">
|
||||||
|
|
||||||
|
<!--Main canvas-->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPicture" id="workspace">
|
<object class="GtkPicture" id="workspace">
|
||||||
<property name="content-fit">cover</property>
|
<property name="content-fit">contain</property>
|
||||||
<property name="hexpand">true</property>
|
<property name="hexpand">true</property>
|
||||||
<property name="vexpand">true</property>
|
<property name="vexpand">true</property>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<!--Tool selector-->
|
||||||
|
<child type="overlay">
|
||||||
|
<object class="GtkBox" id="toolstrip">
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
|
||||||
|
<property name="margin-start">12</property>
|
||||||
|
<property name="margin-top">12</property>
|
||||||
|
<property name="margin-bottom">12</property>
|
||||||
|
|
||||||
|
<!--Tool buttons-->
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">insert-object-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">edit-copy-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
<!--Sidepanel (layers & modifiers)-->
|
<!--Sidepanel (layers & modifiers)-->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame" id="sidepanel">
|
<object class="GtkFrame" id="sidepanel">
|
||||||
|
|||||||
Reference in New Issue
Block a user