File tree Expand file tree Collapse file tree 8 files changed +32
-15
lines changed
Expand file tree Collapse file tree 8 files changed +32
-15
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ src = [
2020 ' src/tools/screenshot.cpp' ,
2121 ' src/tools/save-load.cpp' ,
2222 ' src/tools/pen.cpp' ,
23- ' src/utils/which .c' ,
23+ ' src/utils/misc .c' ,
2424]
2525
2626subdir (' po' )
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ void setupWidgets(){
6363 if (floatingSettings->current_page == 0 ){
6464 floatingSettings->setHide ();
6565 return ;
66+ }
67+ if (drawing->getPen () != PEN && drawing->getPen () != MARKER){
68+ setPen (PEN);
6669 }
6770 floatingSettings->setPage (0 );
6871 floatingWidget->moveAction ();
Original file line number Diff line number Diff line change 2727#include <libintl.h>
2828
2929
30+ extern "C" {
31+ extern size_t _cur_time ;
32+ size_t get_epoch ();
33+ char * which (const char * cmd );
34+ }
35+
36+
3037#ifndef DEBUG
3138#define debug (...)
3239#else
33- #define debug printf("[%s]:", __func__); printf
40+ #define debug printf("[%s:%ld ]:", __func__, get_epoch() - _cur_time); _cur_time = get_epoch( ); printf
3441#endif
3542
43+
3644#define _ (String ) gettext(String)
3745
3846#include "utils/Settings.h"
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ void setupPenType(){
7575 });
7676
7777 penButtons[ERASER] = create_button (ERASER, [=](){
78+ setPenStyle (SPLINE);
7879 setPen (ERASER);
7980 });
8081
Original file line number Diff line number Diff line change @@ -15,13 +15,13 @@ void updateGui(){
1515 toolButtons[PENMENU]->setStyleSheet (" background-color: none;" );
1616 toolButtons[ERASERMENU]->setStyleSheet (" background-color: none;" );
1717
18+ set_icon (get_icon_by_id (PEN), toolButtons[PENMENU]);
1819 if (drawing->getPen () == MARKER || drawing->getPen () == PEN){
1920 set_icon (get_icon_by_id (drawing->getPen ()), toolButtons[PENMENU]);
2021 toolButtons[PENMENU]->setStyleSheet (" background-color:" +drawing->penColor .name ()+" ;" );
2122 } else if (drawing->getPen () == ERASER){
2223 toolButtons[ERASERMENU]->setStyleSheet (" background-color:" +drawing->penColor .name ()+" ;" );
2324 }
24- toolButtons[SHAPEMENU]->setEnabled (drawing->getPen () != ERASER);
2525 set_icon (get_icon_by_id (drawing->getPenStyle ()), toolButtons[SHAPEMENU]);
2626 // Update button backgrounds
2727 for (auto it = penButtons.begin (); it != penButtons.end (); ++it) {
Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ extern DrawingWidget *drawing;
1919
2020#define _ (String ) gettext(String)
2121
22- extern " C" {
23- #include " which.h"
24- }
2522
2623void takeScreenshot (){
2724 QString pics = QStandardPaths::writableLocation (QStandardPaths::PicturesLocation);
Original file line number Diff line number Diff line change 1010#include <string.h>
1111#include <sys/stat.h>
1212
13- #include "which.h"
13+ #include <sys/time.h>
14+ #include <fcntl.h>
15+ #include <stdlib.h>
16+ #include <sys/file.h>
17+ #include <errno.h>
18+
19+ size_t _cur_time ;
20+ size_t get_epoch (){
21+ struct timeval tv ;
22+ gettimeofday (& tv , NULL );
23+ return 1000000 * tv .tv_sec + tv .tv_usec ;
24+ }
1425
15- char * which (char * cmd ){
26+
27+ char * which (const char * cmd ){
1628 char * fullPath = strdup (getenv ("PATH" )); // Duplicate the PATH string
1729
1830 struct stat buffer ;
1931 int exists ;
20- char * fileOrDirectory = cmd ;
32+ char * fileOrDirectory = ( char * ) cmd ;
2133 char * fullfilename = calloc (1024 , sizeof (char ));
2234
2335 char * token = strtok (fullPath , ":" );
@@ -31,9 +43,9 @@ char* which(char* cmd){
3143 return fullfilename ;
3244 }
3345
34- token = strtok (NULL , ":" ); /* next token */
46+ token = strtok (NULL , ":" ); /* next token */
3547 }
3648 free (fullPath ); // Free the duplicated string
3749 free (fullfilename );
3850 return "" ;
39- }
51+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments