master
Alessandro Mauri 2 years ago
parent 73924ed0a6
commit 48aefa32f5
  1. 5
      TODO
  2. 15
      src/main.c

@ -52,11 +52,12 @@
[x] selected + tab == indent up
[x] selected +shift+tab == indent down
[x] change alt+<number> to ctrl+<number>
[ ] add multi cursor system
[ ] doc: add multi cursor system
[ ] add binding to open up a cheatsheet of keybinding, with a
search feature
[x] implement visual "ruler" at column 80
[ ] show hidden files config and binding
[ ] treeview: show hidden files config and binding
[ ] treeview: add a config to hide files bsed on patterns (*.\.o etc)
[ ] syntax: highlight FIXME TODO BUG FIX and IMPROVEMENT keywords
[ ] do not open doc in new tab if current tab has an unchanged document
[ ] doc: add auto close brackets and quotes

@ -15,13 +15,15 @@
SDL_Window *window;
static double get_scale(void)
static double get_scale(SDL_DisplayMode *dm)
{
float dpi, s;
SDL_GetDisplayDPI(0, NULL, &dpi, NULL);
// TODO: get the current window's screen not the primary
printf("w: %d, h: %d\n", dm->w, dm->h);
s = (1.0/dpi)*25.4; // size of a point
// as per standard 14 point should be 3mm
return floor((FONT_14PT_SIZE_MM/(14*s))*10)/10.0;
return fmax(1.0, floor((FONT_14PT_SIZE_MM/(14*s))*10)/10.0);
}
static void get_exe_filename(char *buf, int sz)
@ -70,12 +72,15 @@ int main(int argc, char **argv)
#endif
SDL_DisplayMode dm;
SDL_GetCurrentDisplayMode(0, &dm);
SDL_GetDesktopDisplayMode(0, &dm);
window = SDL_CreateWindow(
"", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
dm.w * 0.8, dm.h * 0.8,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN);
int wd = SDL_GetWindowDisplayIndex(window);
printf("%d \n", wd);
SDL_GetDesktopDisplayMode(wd, &dm);
init_window_icon();
ren_init(window);
@ -97,7 +102,9 @@ int main(int argc, char **argv)
lua_pushstring(L, SDL_GetPlatform());
lua_setglobal(L, "PLATFORM");
lua_pushnumber(L, get_scale());
double scale = get_scale(&dm);
printf("%f\n", scale);
lua_pushnumber(L, scale);
lua_setglobal(L, "SCALE");
char exename[2048];

Loading…
Cancel
Save