2022-07-06 17:51:51 +00:00
/*
* settings . c
*
* Created on : 6 и ю л . 2022 г .
* Author : alexander
*/
# include <iup.h>
2022-07-07 16:35:48 +00:00
2022-07-06 17:51:51 +00:00
# include <stdlib.h>
# include <stdbool.h>
2022-07-18 11:13:49 +00:00
# include "monitor.h"
2022-07-11 17:06:05 +00:00
# include <stdio.h>
2022-07-11 10:12:29 +00:00
2022-07-06 17:51:51 +00:00
# include "settings.h"
# include "arguments.h"
2022-07-07 16:35:48 +00:00
# include "node_settings.h"
2023-02-16 16:23:41 +00:00
# include "about.h"
2022-07-06 17:51:51 +00:00
2022-07-08 16:45:45 +00:00
void toggleActive ( Ihandle * self , char * name )
{
IupSetInt ( IupGetDialogChild ( self , name ) , " ACTIVE " , ! IupGetInt ( IupGetDialogChild ( self , name ) , " ACTIVE " ) ) ;
}
2022-07-07 16:35:48 +00:00
static int settingsClose ( Ihandle * self )
2022-07-06 17:51:51 +00:00
{
2022-07-08 16:45:45 +00:00
resetChangeSettings ( ) ;
2022-07-07 16:35:48 +00:00
IupSetAttribute ( IupGetDialog ( self ) , " SIMULATEMODAL " , " OFF " ) ;
IupHide ( IupGetDialog ( self ) ) ;
2022-07-06 17:51:51 +00:00
return IUP_DEFAULT ;
}
static int settingsSave ( Ihandle * self )
{
2022-07-08 16:45:45 +00:00
saveChangeSettings ( ) ;
2022-07-18 11:13:49 +00:00
dbSaveMonitors ( IupGetAttribute ( IupGetDialogChild ( self , " MONITORS " ) , " VALUESTRING " ) ) ;
2022-07-07 16:35:48 +00:00
IupSetAttribute ( IupGetDialog ( self ) , " SIMULATEMODAL " , " OFF " ) ;
IupHide ( IupGetDialog ( self ) ) ;
2022-07-06 17:51:51 +00:00
return IUP_DEFAULT ;
}
2022-07-07 16:35:48 +00:00
static int settingsTglAuthentication ( Ihandle * self )
2022-07-06 17:51:51 +00:00
{
2022-07-08 16:45:45 +00:00
changeParameter ( PARAMETER_AUTHENTICATION ) ;
return IUP_DEFAULT ;
}
2022-07-11 10:12:29 +00:00
static int settingsTglCertIgnore ( Ihandle * self )
{
changeParameter ( PARAMETER_CERTIGNORE ) ;
return IUP_DEFAULT ;
}
static int settingsTglThemes ( Ihandle * self )
{
changeParameter ( PARAMETER_THEMES ) ;
return IUP_DEFAULT ;
}
static int settingsTglWallpaper ( Ihandle * self )
{
changeParameter ( PARAMETER_WALLPAPER ) ;
return IUP_DEFAULT ;
}
2023-02-16 12:38:49 +00:00
static int settingsTglDecorations ( Ihandle * self )
{
changeParameter ( PARAMETER_DECORATIONS ) ;
return IUP_DEFAULT ;
}
2022-07-13 05:58:34 +00:00
static int settingsTglSound ( Ihandle * self )
{
changeParameter ( PARAMETER_SOUND ) ;
return IUP_DEFAULT ;
}
static int settingsTglFonts ( Ihandle * self )
{
changeParameter ( PARAMETER_FONTS ) ;
return IUP_DEFAULT ;
}
static int settingsTglEncryption ( Ihandle * self )
{
changeParameter ( PARAMETER_ENCRYPTION ) ;
return IUP_DEFAULT ;
}
static int settingsTglCompression ( Ihandle * self )
{
changeParameter ( PARAMETER_COMPRESSION ) ;
return IUP_DEFAULT ;
}
2022-07-08 16:45:45 +00:00
static int settingsUseSecurity ( Ihandle * self )
{
changeParameter ( PARAMETER_SECURITY ) ;
toggleActive ( self , " SECURITY_TLS " ) ;
toggleActive ( self , " SECURITY_RDP " ) ;
toggleActive ( self , " SECURITY_NLA " ) ;
toggleActive ( self , " SECURITY_EXT " ) ;
2022-07-07 16:35:48 +00:00
return IUP_DEFAULT ;
}
2022-07-08 16:45:45 +00:00
static void settingsChooseSecurity ( Ihandle * self , int state )
{
if ( state = = 1 )
{
int tool_index = IupGetInt ( self , " TOOLINDEX " ) ;
switch ( tool_index )
{
case 0 :
{
changeValue ( PARAMETER_SECURITY , VALUE_SECURITY_TLS ) ;
break ;
}
case 1 :
{
changeValue ( PARAMETER_SECURITY , VALUE_SECURITY_RDP ) ;
break ;
}
case 2 :
{
changeValue ( PARAMETER_SECURITY , VALUE_SECURITY_NLA ) ;
break ;
}
case 3 :
{
changeValue ( PARAMETER_SECURITY , VALUE_SECURITY_EXT ) ;
break ;
}
}
}
}
2022-07-11 10:12:29 +00:00
static int settingsUseBitsPerPixel ( Ihandle * self )
{
changeParameter ( PARAMETER_BITSPERPIXEL ) ;
toggleActive ( self , " BITSPERPIXEL_8 " ) ;
toggleActive ( self , " BITSPERPIXEL_16 " ) ;
toggleActive ( self , " BITSPERPIXEL_24 " ) ;
toggleActive ( self , " BITSPERPIXEL_32 " ) ;
return IUP_DEFAULT ;
}
static void settingsChooseBitsPerPixel ( Ihandle * self , int state )
{
if ( state = = 1 )
{
int tool_index = IupGetInt ( self , " TOOLINDEX " ) ;
switch ( tool_index )
{
case 0 :
{
changeValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_8 ) ;
break ;
}
case 1 :
{
changeValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_16 ) ;
break ;
}
case 2 :
{
changeValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_24 ) ;
break ;
}
case 3 :
{
changeValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_32 ) ;
break ;
}
}
}
}
2022-07-11 17:06:05 +00:00
static int settingsChooseMonitor ( Ihandle * ih , char * text , int item , int state )
2022-07-11 10:12:29 +00:00
{
2022-07-11 17:06:05 +00:00
if ( state = = 1 )
{
changeValue ( PARAMETER_MONITORS , item - 1 ) ;
}
return IUP_DEFAULT ;
}
static int settingsTglMultimonitor ( Ihandle * self )
{
changeParameter ( PARAMETER_MULTIMONITOR ) ;
IupSetInt ( IupGetDialogChild ( self , " MONITORS " ) , " ACTIVE " , ! IupGetInt ( IupGetDialogChild ( self , " SETTINGS_TGL_MULTIMONITOR " ) , " VALUE " ) ) ;
setParameter ( PARAMETER_MONITORS , ! IupGetInt ( IupGetDialogChild ( self , " SETTINGS_TGL_MULTIMONITOR " ) , " VALUE " ) ) ;
return IUP_DEFAULT ;
}
static int settingsTglFullscreen ( Ihandle * self )
{
changeParameter ( PARAMETER_FULLSCREEN ) ;
toggleActive ( self , " SETTINGS_TGL_MULTIMONITOR " ) ;
2022-07-13 05:58:34 +00:00
IupSetInt ( IupGetDialogChild ( self , " MONITORS " ) , " ACTIVE " , ! IupGetInt ( IupGetDialogChild ( self , " SETTINGS_TGL_MULTIMONITOR " ) , " VALUE " ) & & IupGetInt ( IupGetDialogChild ( self , " SETTINGS_TGL_FULLSCREEN " ) , " VALUE " ) ) ;
2022-07-11 17:06:05 +00:00
setParameter ( PARAMETER_MONITORS , ! IupGetInt ( IupGetDialogChild ( self , " SETTINGS_TGL_MULTIMONITOR " ) , " VALUE " ) ) ;
2022-07-11 10:12:29 +00:00
return IUP_DEFAULT ;
}
2022-07-07 16:35:48 +00:00
/*
* Б л о к н а с т р о е к
*/
2022-07-08 16:45:45 +00:00
static Ihandle * settingsBoxCheckbox ( )
2022-07-07 16:35:48 +00:00
{
2023-02-16 12:38:49 +00:00
Ihandle * tglAuthentication , * tglCertIgnore , * tglThemes , * tglWallpaper , * tglDecorations , * tglSound , * tglFonts , * tglEncryption , * tglCompression ;
2022-07-06 17:51:51 +00:00
2022-07-07 16:35:48 +00:00
tglAuthentication = IupToggle ( " Аутентификация " , NULL ) ;
2022-07-11 10:12:29 +00:00
tglCertIgnore = IupToggle ( " Игнорировать сертификат " , NULL ) ;
tglThemes = IupToggle ( " Отключить темы " , NULL ) ;
tglWallpaper = IupToggle ( " Отключить обои " , NULL ) ;
2023-02-16 12:38:49 +00:00
tglDecorations = IupToggle ( " Отключить оформление окон " , NULL ) ;
2022-07-07 16:35:48 +00:00
2022-07-13 05:58:34 +00:00
tglSound = IupToggle ( " Поддержка звука " , NULL ) ;
tglFonts = IupToggle ( " Отключить прорисовку шрифтов " , NULL ) ;
tglEncryption = IupToggle ( " Отключить шифрование " , NULL ) ;
tglCompression = IupToggle ( " Сжатие данных " , NULL ) ;
2022-07-08 16:45:45 +00:00
IupSetInt ( tglAuthentication , " VALUE " , getSetParameter ( PARAMETER_AUTHENTICATION ) ) ;
2022-07-11 10:12:29 +00:00
IupSetInt ( tglCertIgnore , " VALUE " , getSetParameter ( PARAMETER_CERTIGNORE ) ) ;
IupSetInt ( tglThemes , " VALUE " , getSetParameter ( PARAMETER_THEMES ) ) ;
IupSetInt ( tglWallpaper , " VALUE " , getSetParameter ( PARAMETER_WALLPAPER ) ) ;
2023-02-16 12:38:49 +00:00
IupSetInt ( tglDecorations , " VALUE " , getSetParameter ( PARAMETER_DECORATIONS ) ) ;
2022-07-13 05:58:34 +00:00
IupSetInt ( tglSound , " VALUE " , getSetParameter ( PARAMETER_SOUND ) ) ;
IupSetInt ( tglFonts , " VALUE " , getSetParameter ( PARAMETER_FONTS ) ) ;
IupSetInt ( tglEncryption , " VALUE " , getSetParameter ( PARAMETER_ENCRYPTION ) ) ;
IupSetInt ( tglCompression , " VALUE " , getSetParameter ( PARAMETER_COMPRESSION ) ) ;
2022-07-07 16:35:48 +00:00
2022-07-11 17:06:05 +00:00
return IupSetAttributes (
2023-02-16 12:38:49 +00:00
IupFrame (
IupVbox (
IupSetCallbacks ( IupSetAttributes ( tglAuthentication , " NAME=SETTINGS_TGL_AUTHENTICATION, TIP= \" Получить окно входа авторизации \" " ) , " ACTION " , ( Icallback ) settingsTglAuthentication , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglCertIgnore , " NAME=SETTINGS_TGL_AUTHENTICATION, TIP= \" Игнорировать подтверждение принятия сертификата \" " ) , " ACTION " , ( Icallback ) settingsTglCertIgnore , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglThemes , " NAME=SETTINGS_TGL_THEMES, TIP= \" Отключить поддержку тем оформления (улучшает скорость соединения) \" " ) , " ACTION " , ( Icallback ) settingsTglThemes , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglWallpaper , " NAME=SETTINGS_TGL_WALLPAPER, TIP= \" Отключить поддержку обоев рабочего стола (улучшает скорость соединения) \" " ) , " ACTION " , ( Icallback ) settingsTglWallpaper , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglDecorations , " NAME=SETTINGS_TGL_DECORATIONS, TIP= \" Отключить поддержку оформления окон (улучшает скорость соединения) \" " ) , " ACTION " , ( Icallback ) settingsTglDecorations , NULL ) ,
# ifdef IUP_WITH_SOUND_CHECKBOX
IupSetCallbacks ( IupSetAttributes ( tglSound , " NAME=SETTINGS_TGL_SOUND, TIP= \" Включить поддержку звука с удаленного сервера \" " ) , " ACTION " , ( Icallback ) settingsTglSound , NULL ) ,
# endif
IupSetCallbacks ( IupSetAttributes ( tglFonts , " NAME=SETTINGS_TGL_FONTS, TIP= \" Отключить прорисовку шрифтов (улучшает скорость соединения) \" " ) , " ACTION " , ( Icallback ) settingsTglFonts , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglEncryption , " NAME=SETTINGS_TGL_ENCRYPTION, TIP= \" Отключить шифрование данных \" " ) , " ACTION " , ( Icallback ) settingsTglEncryption , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglCompression , " NAME=SETTINGS_TGL_COMPRESSION, TIP= \" Включить сжатие данных (улучшает скорость соединения) \" " ) , " ACTION " , ( Icallback ) settingsTglCompression , NULL ) ,
NULL
)
) , " TITLE= \" Общие \" , MARGIN=10x10 "
) ;
2022-07-07 16:35:48 +00:00
}
2022-07-08 16:45:45 +00:00
static Ihandle * settingsBoxSecurity ( )
2022-07-07 16:35:48 +00:00
{
2022-07-08 16:45:45 +00:00
Ihandle * tglSecurity ;
Ihandle * tglTLS , * tglRDP , * tglNLA , * tglEXT ;
Ihandle * grdSecurity ;
tglSecurity = IupToggle ( " Использовать " , NULL ) ;
IupSetInt ( tglSecurity , " VALUE " , getSetParameter ( PARAMETER_SECURITY ) ) ;
2022-07-14 10:40:51 +00:00
IupSetAttribute ( tglSecurity , " TIP " , " Выбрать конкретный протокол передачи данных " ) ;
2022-07-11 10:12:29 +00:00
IupSetCallback ( tglSecurity , " ACTION " , ( Icallback ) settingsUseSecurity ) ;
2022-07-08 16:45:45 +00:00
tglTLS = IupToggle ( " TLS " , NULL ) ;
IupSetInt ( tglTLS , " VALUE " , getSetValue ( PARAMETER_SECURITY , VALUE_SECURITY_TLS ) ) ;
IupSetInt ( tglTLS , " ACTIVE " , getSetParameter ( PARAMETER_SECURITY ) ) ;
tglRDP = IupToggle ( " RDP " , NULL ) ;
IupSetInt ( tglRDP , " VALUE " , getSetValue ( PARAMETER_SECURITY , VALUE_SECURITY_RDP ) ) ;
IupSetInt ( tglRDP , " ACTIVE " , getSetParameter ( PARAMETER_SECURITY ) ) ;
tglNLA = IupToggle ( " NLA " , NULL ) ;
IupSetInt ( tglNLA , " VALUE " , getSetValue ( PARAMETER_SECURITY , VALUE_SECURITY_NLA ) ) ;
IupSetInt ( tglNLA , " ACTIVE " , getSetParameter ( PARAMETER_SECURITY ) ) ;
tglEXT = IupToggle ( " EXT " , NULL ) ;
IupSetInt ( tglEXT , " VALUE " , getSetValue ( PARAMETER_SECURITY , VALUE_SECURITY_EXT ) ) ;
IupSetInt ( tglEXT , " ACTIVE " , getSetParameter ( PARAMETER_SECURITY ) ) ;
2022-07-11 10:12:29 +00:00
grdSecurity = IupRadio (
IupGridBox (
IupSetCallbacks ( IupSetAttributes ( tglTLS , " NAME=SECURITY_TLS, TOOLINDEX=0 " ) , " ACTION " , ( Icallback ) settingsChooseSecurity , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglRDP , " NAME=SECURITY_RDP, TOOLINDEX=1 " ) , " ACTION " , ( Icallback ) settingsChooseSecurity , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglNLA , " NAME=SECURITY_NLA, TOOLINDEX=2 " ) , " ACTION " , ( Icallback ) settingsChooseSecurity , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglEXT , " NAME=SECURITY_EXT, TOOLINDEX=3 " ) , " ACTION " , ( Icallback ) settingsChooseSecurity , NULL ) ,
NULL ) ) ;
2022-07-08 16:45:45 +00:00
return IupHbox ( IupSetAttributes ( IupFrame ( IupVbox ( tglSecurity , grdSecurity , NULL ) ) , " TITLE= \" Протокол безопасности \" , MARGIN=15x10 " ) , NULL ) ;
}
2022-07-07 16:35:48 +00:00
2022-07-11 10:12:29 +00:00
static Ihandle * settingsBoxBitsPerPixel ( )
{
Ihandle * tglBitsPerPixel ;
Ihandle * tgl8 , * tgl16 , * tgl24 , * tgl32 ;
Ihandle * grdBitsPerPixel ;
tglBitsPerPixel = IupToggle ( " Использовать " , NULL ) ;
IupSetInt ( tglBitsPerPixel , " VALUE " , getSetParameter ( PARAMETER_BITSPERPIXEL ) ) ;
2022-07-14 10:40:51 +00:00
IupSetAttribute ( tglBitsPerPixel , " TIP " , " Выбрать конкретную глубину цвета (меньше глубина - выше скорость и хуже качество) " ) ;
2022-07-11 10:12:29 +00:00
IupSetCallback ( tglBitsPerPixel , " ACTION " , ( Icallback ) settingsUseBitsPerPixel ) ;
tgl8 = IupToggle ( " 8 бит " , NULL ) ;
IupSetInt ( tgl8 , " VALUE " , getSetValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_8 ) ) ;
IupSetInt ( tgl8 , " ACTIVE " , getSetParameter ( PARAMETER_BITSPERPIXEL ) ) ;
tgl16 = IupToggle ( " 16 бит " , NULL ) ;
IupSetInt ( tgl16 , " VALUE " , getSetValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_16 ) ) ;
IupSetInt ( tgl16 , " ACTIVE " , getSetParameter ( PARAMETER_BITSPERPIXEL ) ) ;
tgl24 = IupToggle ( " 24 бит " , NULL ) ;
IupSetInt ( tgl24 , " VALUE " , getSetValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_24 ) ) ;
IupSetInt ( tgl24 , " ACTIVE " , getSetParameter ( PARAMETER_BITSPERPIXEL ) ) ;
tgl32 = IupToggle ( " 32 бит " , NULL ) ;
IupSetInt ( tgl32 , " VALUE " , getSetValue ( PARAMETER_BITSPERPIXEL , VALUES_BITSPERPIXEL_32 ) ) ;
IupSetInt ( tgl32 , " ACTIVE " , getSetParameter ( PARAMETER_BITSPERPIXEL ) ) ;
grdBitsPerPixel = IupRadio (
IupGridBox ( IupSetCallbacks ( IupSetAttributes ( tgl8 , " NAME=BITSPERPIXEL_8, TOOLINDEX=0 " ) , " ACTION " , ( Icallback ) settingsChooseBitsPerPixel ,
NULL ) , IupSetCallbacks ( IupSetAttributes ( tgl16 , " NAME=BITSPERPIXEL_16, TOOLINDEX=1 " ) , " ACTION " , ( Icallback ) settingsChooseBitsPerPixel ,
NULL ) , IupSetCallbacks ( IupSetAttributes ( tgl24 , " NAME=BITSPERPIXEL_24, TOOLINDEX=2 " ) , " ACTION " , ( Icallback ) settingsChooseBitsPerPixel ,
NULL ) , IupSetCallbacks ( IupSetAttributes ( tgl32 , " NAME=BITSPERPIXEL_32, TOOLINDEX=3 " ) , " ACTION " , ( Icallback ) settingsChooseBitsPerPixel ,
NULL ) ,
NULL ) ) ;
return IupHbox ( IupSetAttributes ( IupFrame ( IupVbox ( tglBitsPerPixel , grdBitsPerPixel , NULL ) ) , " TITLE= \" Глубина цвета \" , MARGIN=15x10 " ) , NULL ) ;
}
static Ihandle * settingsBoxMonitor ( )
{
2022-07-11 17:06:05 +00:00
Ihandle * tglFullscreen , * tglMultimonitor , * ddMonitor ;
2022-07-11 10:12:29 +00:00
2022-07-11 17:06:05 +00:00
tglMultimonitor = IupToggle ( " В с е мониторы" , NULL ) ;
tglFullscreen = IupToggle ( " Н а весь экран" , NULL ) ;
2022-07-11 10:12:29 +00:00
ddMonitor = IupList ( NULL ) ;
2022-07-18 11:13:49 +00:00
Monitors * monitors = loadMonitors ( ) ;
for ( size_t i = 0 ; i < monitors - > size ; + + i )
2022-07-11 10:12:29 +00:00
{
2022-07-18 11:13:49 +00:00
IupSetAttribute ( ddMonitor , monitors - > monitor [ i ] - > data [ 0 ] , monitors - > monitor [ i ] - > data [ 1 ] ) ;
if ( monitors - > monitor [ i ] - > data [ 2 ] [ 0 ] = = ' 1 ' )
IupSetAttribute ( ddMonitor , " VALUE " , monitors - > monitor [ i ] - > data [ 0 ] ) ;
2022-07-11 10:12:29 +00:00
}
2022-07-18 11:13:49 +00:00
freeMonitors ( monitors ) ;
2022-07-11 10:12:29 +00:00
2022-07-11 17:06:05 +00:00
IupSetInt ( tglMultimonitor , " VALUE " , getSetParameter ( PARAMETER_MULTIMONITOR ) ) ;
IupSetInt ( tglFullscreen , " VALUE " , getSetParameter ( PARAMETER_FULLSCREEN ) ) ;
IupSetInt ( tglMultimonitor , " ACTIVE " , getSetParameter ( PARAMETER_FULLSCREEN ) ) ;
IupSetInt ( ddMonitor , " ACTIVE " , getSetParameter ( PARAMETER_FULLSCREEN ) & & ! getSetParameter ( PARAMETER_MULTIMONITOR ) ) ;
return IupSetAttributes (
2023-02-16 16:23:41 +00:00
IupFrame (
IupVbox (
IupSetAttributes (
2022-07-11 17:06:05 +00:00
IupVbox (
2023-02-16 16:23:41 +00:00
IupSetCallbacks ( IupSetAttributes ( tglFullscreen , " NAME=SETTINGS_TGL_FULLSCREEN, EXPAND=YES, TIP= \" Выполнить подключение на весь экран \" " ) , " ACTION " , ( Icallback ) settingsTglFullscreen , NULL ) ,
IupSetCallbacks ( IupSetAttributes ( tglMultimonitor , " NAME=SETTINGS_TGL_MULTIMONITOR, TIP= \" Задействовать все подключенные мониторы \" " ) , " ACTION " , ( Icallback ) settingsTglMultimonitor , NULL ) ,
NULL
) , " MARGIN=0x0, GAP=0x0 " ) ,
IupSetCallbacks ( IupSetAttributes ( ddMonitor , " NAME=MONITORS, DROPDOWN=YES, EXPAND=YES, TIP= \" Выбрать конкретный монитор для подключения \" " ) , " ACTION " , ( Icallback ) settingsChooseMonitor , NULL ) ,
NULL )
) , " TITLE= \" Монитор \" , MARGIN=15x10, GAP=15x0 " ) ;
}
static Ihandle * settingsBoxAbout ( )
{
2023-02-20 06:41:03 +00:00
Ihandle * inputAbout , * formattag ;
2023-02-16 16:23:41 +00:00
inputAbout = IupText ( NULL ) ;
2023-02-20 06:41:03 +00:00
formattag = IupUser ( ) ;
IupSetAttribute ( formattag , " ALIGNMENT " , " CENTER " ) ;
IupSetAttribute ( formattag , " SELECTION " , " 1,1:7,50 " ) ;
IupSetAttribute ( inputAbout , " ADDFORMATTAG_HANDLE " , ( char * ) formattag ) ;
formattag = IupUser ( ) ;
IupSetAttribute ( formattag , " WEIGHT " , " BOLD " ) ;
IupSetAttribute ( formattag , " SELECTION " , " 1,1:1,20 " ) ;
IupSetAttribute ( inputAbout , " ADDFORMATTAG_HANDLE " , ( char * ) formattag ) ;
formattag = IupUser ( ) ;
IupSetAttribute ( formattag , " FONTSIZE " , " 11 " ) ;
IupSetAttribute ( formattag , " SELECTION " , " 1,1:1,20 " ) ;
IupSetAttribute ( inputAbout , " ADDFORMATTAG_HANDLE " , ( char * ) formattag ) ;
formattag = IupUser ( ) ;
IupSetAttribute ( formattag , " FGCOLOR " , " 0 0 255 " ) ;
IupSetAttribute ( formattag , " SELECTION " , " 5,1:5,100 " ) ;
IupSetAttribute ( inputAbout , " ADDFORMATTAG_HANDLE " , ( char * ) formattag ) ;
formattag = IupUser ( ) ;
IupSetAttribute ( formattag , " WEIGHT " , " BOLD " ) ;
IupSetAttribute ( formattag , " SELECTION " , " 6,20:6,100 " ) ;
IupSetAttribute ( inputAbout , " ADDFORMATTAG_HANDLE " , ( char * ) formattag ) ;
2023-02-16 16:23:41 +00:00
IupSetAttribute ( inputAbout , " READONLY " , " YES " ) ;
IupSetAttribute ( inputAbout , " MULTILINE " , " YES " ) ;
IupSetAttribute ( inputAbout , " SIZE " , " 160 " ) ;
IupSetAttribute ( inputAbout , " VISIBLELINES " , " 6 " ) ;
IupSetAttribute ( inputAbout , " PADDING " , " 5 " ) ;
2023-02-20 06:41:03 +00:00
IupSetAttribute ( inputAbout , " FORMATTING " , " YES " ) ;
2023-02-20 16:09:40 +00:00
IupSetAttribute ( inputAbout , " EXPAND " , " YES " ) ;
2023-02-16 16:23:41 +00:00
IupSetAttribute ( inputAbout , " VALUE " , getAbout ( ) ) ;
2023-02-20 16:09:40 +00:00
return IupSetAttributes ( IupFrame ( IupHbox ( inputAbout , NULL ) ) , " TITLE= \" О программе\" , MARGIN=5x5 " ) ;
2022-07-11 10:12:29 +00:00
}
2022-07-08 16:45:45 +00:00
static Ihandle * settingsHorizontalBox ( )
{
2022-07-11 17:06:05 +00:00
return IupSetAttributes (
2023-02-16 16:23:41 +00:00
IupHbox (
IupSetAttributes (
IupVbox ( settingsBoxCheckbox ( ) , settingsBoxMonitor ( ) , NULL ) ,
" NMARGIN=0x0 "
) ,
IupSetAttributes (
IupVbox (
IupSetAttributes ( IupHbox ( settingsBoxSecurity ( ) , settingsBoxBitsPerPixel ( ) , NULL ) , " GAP=10x0 " ) ,
settingsBoxAbout ( ) ,
NULL ) ,
" MARGIN=0x0 " ) ,
NULL ) , " NMARGIN=10x0, NGAP=10x0 "
) ;
2022-07-07 16:35:48 +00:00
}
/*
* Б л о к к н о п о к
*/
2022-07-08 16:45:45 +00:00
static Ihandle * settingsHorizontalBoxButtons ( )
2022-07-07 16:35:48 +00:00
{
Ihandle * btnSave , * btnClose ;
btnSave = IupButton ( " Сохранить " , NULL ) ;
IupSetAttribute ( btnSave , " NAME " , " SETTIGS_BTN_SAVE " ) ;
IupSetAttribute ( btnSave , " TIP " , " Сохранить настройки " ) ;
2023-02-16 12:38:49 +00:00
# ifdef IUP_WITH_COLOR_BUTTONS
2022-07-14 10:40:51 +00:00
IupSetAttribute ( btnSave , " BGCOLOR " , " 0 179 0 " ) ;
IupSetAttribute ( btnSave , " FGCOLOR " , " 255 255 255 " ) ;
2023-02-02 05:47:23 +00:00
# endif
2022-07-07 16:35:48 +00:00
btnClose = IupButton ( " Закрыть " , NULL ) ;
IupSetAttribute ( btnClose , " NAME " , " SETTIGS_BTN_CLOSE " ) ;
2022-07-08 16:45:45 +00:00
IupSetAttribute ( btnClose , " TIP " , " Отменить изменения " ) ;
2023-02-16 12:38:49 +00:00
# ifdef IUP_WITH_COLOR_BUTTONS
2022-07-14 10:40:51 +00:00
IupSetAttribute ( btnClose , " BGCOLOR " , " 204 0 0 " ) ;
IupSetAttribute ( btnClose , " FGCOLOR " , " 255 255 255 " ) ;
2023-02-02 05:47:23 +00:00
# endif
2022-07-07 16:35:48 +00:00
IupSetHandle ( " btnClosePointer " , btnClose ) ;
return IupSetAttributes (
IupHbox ( IupFill ( ) , IupSetCallbacks ( btnSave , " ACTION " , ( Icallback ) settingsSave , NULL ) ,
IupSetCallbacks ( btnClose , " ACTION " , ( Icallback ) settingsClose , NULL ) , IupFill ( ) ,
NULL ) , " ALIGNMENT=ACENTER:ACENTER, GAP=10, MARGIN=10x10 " ) ;
}
int settingsMainWindow ( Ihandle * self )
{
Ihandle * dlg ;
Ihandle * vBoxMain ;
2022-07-08 16:45:45 +00:00
vBoxMain = IupSetAttributes ( IupVbox ( settingsHorizontalBox ( ) , settingsHorizontalBoxButtons ( ) , NULL ) , " NMARGIN=2x2, ALIGNMENT=ACENTER " ) ;
2022-07-06 17:51:51 +00:00
dlg = IupDialog ( vBoxMain ) ;
IupSetAttribute ( dlg , " TITLE " , " Настройки " ) ;
2022-07-07 16:35:48 +00:00
IupSetCallback (
IupSetAttributes ( dlg ,
" ICON=icon, DIALOGFRAME=ON, SIMULATEMODAL=ON, DEFAULTESC=btnClosePointer, TOPMOST=YES, BRINGFRONT=YES, NAME=SETTINGS_MAIN_WINDOW " ) ,
" CLOSE_CB " , ( Icallback ) settingsClose ) ;
2022-07-06 17:51:51 +00:00
IupShowXY ( dlg , IUP_CURRENT , IUP_CURRENT ) ;
return IUP_DEFAULT ;
}