GithubHelp home page GithubHelp logo

luigi's People

Contributors

chrisdownunder avatar nakst avatar neroist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luigi's Issues

Subtle layout issue

In _UIPanelLayout ,

int width = ((child->flags & UI_ELEMENT_H_FILL) || expand) ? hSpace : UIElementMessage(child, UI_MSG_GET_WIDTH, 0, 0);

should be replaced with

int width = ((child->flags & UI_ELEMENT_H_FILL) || expand) ? hSpace : UIElementMessage(child, MSG_GET_WIDTH, (child->flags & ELEMENT_V_FILL) ? perFill : 0, 0);

since the height is known in the case where V_FILL is set.

Similar in the horizontal branch.

Undefined behavior with leading underscores

You have several function whose names start with an underscore followed by a capital letter (specifically _UI), which is undefined behavior according to the C and C++ standards.

Windows codepath problems

Compiling with

cl -Od -Z7 -nologo -TC ./luigi_example.c -link User32.lib Gdi32.lib Shell32.lib

Results in

luigi.h(3678): error C2143: syntax error: missing ')' before '*'
luigi.h(3678): error C2059: syntax error: ')'
luigi.h(3678): error C2100: illegal indirection
luigi.h(3678): error C2143: syntax error: missing ')' before ';'

The line it's complaining about is

void (*callback)(UIElement *) = va_arg(arguments, void (*)(UIElement *));

MSVC doesn't seem to understand a function pointer type without a typedef. I tried changing compiler flags - removing -TC adding -std:c11, -std:c17. It didn't help.

Beyond that, the other problem is that

_UIInitialiseCommon();

runs before

ui.heap = GetProcessHeap();

But there is a font allocation in _UIInitialiseCommon which just crashes since it tries to access ui.heap

SVG editor on base of luigi

Good day.
Thank you for your generous contribution to open source community.

For OCR training and asian fonts development we need implement editable base SVG shapes on base of luigi. Reslts we will be happy to share.

After page OCR in training mode it is need edit about thousand of restangles on every OCR page - need to know size and position after element edition with mouse and set unicode name of element. HTML just freeze on this task.

Which UI_Element you think may give us a correct start?
UIMDIClientCreate look most suitable but it will be need make it more light - close active element by keyboard and common button for example. No need close button on small shape.
Will be happy to any advice.
Alexander

ARM support

Hi,

first off, congrats for the effort put into this single header lib. I am honestly amazed at some of the tricks i see in here.
Getting to the point, the library works flawlessly on my x86-64 machine, but i noticed it segfaults on ARM (32 bit) . Note : i replaced some of the x86 specific SIMD instructions with standard functions in order to compile for arm and i recompiled and tested them on x86 and i confirm they still work the same.
I have also statically compiled a binary to run some tests using qemu on my workstation, getting the same segfault.

Anyways, do you plan on supporting the ARM arch? I know theres a lot of low level stuff going on in the header, so the fact that im running this on 32 bit is causing it to segfault, and im honestly at a loss.

Sorry for bothering

luigi_example.c out of date (doesn't compile)

On linux, command

gcc luigi_example.c -lX11 -lm -o luigi

Produces

luigi_example.c: In function ‘ThemeEditorTableMessage’:
luigi_example.c:59:64: error: ‘UITheme’ {aka ‘struct UITheme’} has no member named ‘colors’
   59 |    return snprintf(m->buffer, m->bufferBytes, "#%.6x", ui.theme.colors[m->index]);
      |                                                                ^
luigi_example.c:63:24: error: ‘UITheme’ {aka ‘struct UITheme’} has no member named ‘colors’
   63 |   UIColorToHSV(ui.theme.colors[themeEditorSelectedColor],
      |                        ^
luigi_example.c: In function ‘ThemeEditorColorPickerMessage’:
luigi_example.c:75:13: error: ‘UITheme’ {aka ‘struct UITheme’} has no member named ‘colors’
   75 |    &ui.theme.colors[themeEditorSelectedColor]);
      |             ^

Seems like it's expecting colors array in UITheme? I fixed it like this just to run it

typedef union UITheme {
	struct {
		uint32_t panel1, panel2, selected, border;
		uint32_t text, textDisabled, textSelected;
		uint32_t buttonNormal, buttonHovered, buttonPressed, buttonDisabled;
		uint32_t textboxNormal, textboxFocused;
		uint32_t codeFocused, codeBackground, codeDefault, codeComment, codeString, codeNumber, codeOperator, codePreprocessor;
	};
	uint32_t colors[20];
} UITheme;

Which works but is there some other intended way to access those colors as an array? Also, themeItems appears to be out of date. Replacing it with

const char *themeItems[] = {
	"panel1", 
	"panel2",
	"selected",
	"border",
	"text", 
	"textDisabled", 
	"textSelected", 
	"buttonNormal", 
	"buttonHovered", 
	"buttonPressed", 
	"buttonDisabled",
	"textboxNormal", 
	"textboxFocused", 
	"codeFocused", 
	"codeBackground", 
	"codeDefault", 
	"codeComment", 
	"codeString", 
	"codeNumber", 
	"codeOperator", 
	"codePreprocessor",
};

Appears to make the example work as intended.

FreeType for font rendering (linux)

gcc -O2 luigi_example.c -lX11 -lm -lfreetype -DUI_FREETYPE `pkg-config --cflags freetype2` -DUI_FONT_PATH=./luculent.ttf -DUI_FONT_SIZE=24

The command compiles fine, but the font is the same as without the freetype flags.

Its possible to change the font size of the default X11 (no freetype) font ?
Thanks and cool project.

UITable scrollbar behaviour

Hi nakst

Currently when you use a UITable, the vertical scrollbar extends into the table header background area.

The screenshot showing your Config Editor demonstrates this scrollbar behaviour, as does the luigi/luigi2 example.

For your consideration, a two-line patch which:

  • changes the scrollbar bounds.t so it fits within the table draw area
  • moves the table bounds.r update to after UIDrawControl is called for the table header background (UI_DRAW_CONTROL_TABLE_BACKGROUND), so this call paints across the full width

See pull request #15

Regards,
OzChris / ChrisDownUnder

Essence and Luigi development

Good day.

For benefit of Essence development will be useful to rename Luigi to essence_ui.h
The reason is:

  1. Essence is the main goal.
  2. Luigi is promotion driver and it is need connect it to main brand.
  3. Each person are able to remember 200 brands total.

Dear Nakst, which license you have in mind for whole Essence family?

Luigi and Asian languages Xutf8LookupString input

Good day.

We have in progress Asian languages input for Luigi.
For now problem is it XLib input for multi-byte characters.
Inside Luigi we are just handle wchar_t instead of char by Freetype (or Pango).
This way we are able to read Xutf8LookupString input for first part of unicode – up to 0x0600 (Arabian) at last.

Problem is we can not fire KeyPeess XEvent by any keyboard driver upper then 0x0700.
Any advice or idea how handle KeyPress in 0x0f00 - 0xffff (tibetan, sanskrit, japan) ranges in XLib?
May we kindly ask you test Xutf8LookupString and XwcLookupString on your computer for upper unicode ranges?

// in
//bool _UIProcessEvent(XEvent *event)

m.textBytes = Xutf8LookupString(window->xic, &event->xkey, text, sizeof(text) - 1, &symbol, &status); 
			
         printf("input utf8:");  
         for(int i=0;i<m.textBytes;i++){        
            printf("%x ",text[i]);       
         }  
         printf("\n");
         
         
         wchar_t textw[32];         
         int wlen=XwcLookupString(window->xic, &event->xkey, textw, sizeof(textw) - 1, &symbol, &status); 
         printf("input utf16:");  
         for(int i=0;i<wlen;i++){        
            printf("%x ",textw[i]);       
         }  
         printf("\n");			

Error when compiling on Windows with -DWIN32_LEAN_AND_MEAN

I get this error when compiling with -DWIN32_LEAN_AND_MEAN:

In file included from luigi_example.c:7:
luigi.h: In function '_UIWindowProcedure':
luigi.h:5497:17: error: unknown type name 'HDROP'
 5497 |                 HDROP drop = (HDROP) wParam;
 5497 |                 HDROP drop = (HDROP) wParam;
      |                               ^~~~~
luigi.h:5497:31: note: each undeclared identifier is reported only once for each function it appears in
luigi.h:5497:38: error: expected ',' or ';' before 'wParam'
 5497 |                 HDROP drop = (HDROP) wParam;
      |                                      ^~~~~~
luigi.h:5498:29: warning: implicit declaration of function 'DragQueryFil
' [-Wimplicit-function-declaration]
 5498 |                 int count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
      |                             ^~~~~~~~~~~~~
luigi.h:5511:17: warning: implicit declaration of function 'DragFinish'
-Wimplicit-function-declaration]
 5511 |                 DragFinish(drop);
      |                 ^~~~~~~~~~

This is an issue mainly because Nim std uses -DWIN32_LEAN_AND_MEAN.

I believe this can be fixed by explicitly including shellapi.h.

luigi2 - Gauge and Slider (vertical layout and SetPosition)

Hi nakst

I've made some enhancements to Gauge and Slider elements in my personal fork. Would you be interested in merging these changes?

  • Support for vertical layout of Gauge and Slider elements
  • New UISliderSetPosition procedure, and update to the existing UIGaugeSetPosition
  • New 'luigi2_example.c' file (a copy of the original luigi example with updates to build on luigi2 and demonstrate these new features)

(See my 'luigi vs luigi2' issue for further discussion on the new example file.)

I tried to keep the approach in line with your existing code. If you would implement these features in a different manner, I would be interested to know how, so that I can keep further updates I make in line with your approach.

If you are happy to merge these changes (pull request Luigi2 - gauge and slider improvements), you're welcome to create the initial luigi2_example.c file in your own repository before merging my changes, if you would like to keep an accurate version history (i.e., so it registers that you wrote the original file and I only contributed the few lines of changed code).

Regards,
OzChris / ChrisDownUnder

luigi vs luigi2

Hi nakst

With luigi2 being the actively developed version of this library, I was wondering:

  • are you planning to remove the luigi header and examples to focus only on luigi2, or
  • are you planning to have them co-exist for some time going forward?

The reason I ask is to do with incompatibilities (or just new APIs) between luigi2 and luigi + it's examples.

The current luigi examples do not compile with luigi2 for two main reasons that I can see:

  1. the ColorPicker element isn't present in luigi2
  2. the change from UI_PANEL_GRAY/WHITE to UI_PANEL_COLOR_1/2.

Proposal

If you are planning to keep luigi and luigi2 coexisting, could I suggest adding a 'luigi2_example.c' file to the repository to compile against luigi2? This would also allow further updates to the example to showcase luigi2 improvements without breaking the luigi example.

If you are keeping both versions of the library, see my Luigi1 - backport luigi2 fixes pull request with a few small quality of life improvements in case anyone uses the luigi1 header and examples -- for your consideration.

Note: See my other raised issue/pull request, which includes proposed luigi2 element updates along with an updated version of 'luigi2_example.c' demonstrating those features.

Regards,
OzChris / ChrisDownUnder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.