feat: add css logging
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
BasedOnStyle: LLVM
|
||||
ColumnLimit: 80
|
||||
BreakBeforeBraces: Attach
|
||||
IndentWidth: 2
|
||||
IndentWidth: 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));
|
||||
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_canvas_update(canvas);
|
||||
|
||||
@@ -52,7 +52,6 @@ static void activate(GtkApplication *app, gpointer user_data) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
//write_ppm("out.ppm", &fb);
|
||||
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
#include "uicontroller.h"
|
||||
#include "gdk/gdk.h"
|
||||
#include "gtk/gtk.h"
|
||||
#include "gtk/gtkcssprovider.h"
|
||||
|
||||
void vektor_uictrl_init(GtkApplication *app, VektorWidgetState *stateOut) {
|
||||
GtkBuilder *builder = gtk_builder_new();
|
||||
GError *error = NULL;
|
||||
|
||||
g_print("%s\n", g_get_current_dir());
|
||||
|
||||
// TODO: .ui files as resources instead of sketchy relative paths
|
||||
if (!gtk_builder_add_from_file(builder, "./ui/main.ui", &error)) {
|
||||
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->workspacePaned =
|
||||
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="wide-handle">true</property>
|
||||
|
||||
<!--Main viewport area-->
|
||||
|
||||
<child>
|
||||
<!--Overlay to hold tool selector and canvas-->
|
||||
<object class="GtkOverlay">
|
||||
|
||||
<!--Main canvas-->
|
||||
<child>
|
||||
<object class="GtkPicture" id="workspace">
|
||||
<property name="content-fit">cover</property>
|
||||
<property name="content-fit">contain</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="vexpand">true</property>
|
||||
|
||||
</object>
|
||||
</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)-->
|
||||
<child>
|
||||
<object class="GtkFrame" id="sidepanel">
|
||||
|
||||
Reference in New Issue
Block a user