Рабочая версия мез мультипараметров
This commit is contained in:
		
							parent
							
								
									bcbb10ea18
								
							
						
					
					
						commit
						3b6a0a433a
					
				
					 7 changed files with 209 additions and 76 deletions
				
			
		
							
								
								
									
										13
									
								
								arguments.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								arguments.c
									
										
									
									
									
								
							| 
						 | 
					@ -7,6 +7,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include "arguments.h"
 | 
					#include "arguments.h"
 | 
				
			||||||
 | 
					#include "node_settings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void settingsLoad()
 | 
					void settingsLoad()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -16,6 +17,13 @@ void settingsLoad()
 | 
				
			||||||
    settingsAddKey(PARAMETER_PASSWORD, "/p:", true, true);
 | 
					    settingsAddKey(PARAMETER_PASSWORD, "/p:", true, true);
 | 
				
			||||||
    settingsAddKey(PARAMETER_MULTIMONITOR, "/multimon", false, true);
 | 
					    settingsAddKey(PARAMETER_MULTIMONITOR, "/multimon", false, true);
 | 
				
			||||||
    settingsAddKey(PARAMETER_FULLSCREEN, "/f", false, true);
 | 
					    settingsAddKey(PARAMETER_FULLSCREEN, "/f", false, true);
 | 
				
			||||||
 | 
					    settingsAddKey(PARAMETER_AUTHENTICATION, "-authentication", false, true);
 | 
				
			||||||
 | 
					    settingsAddKey(PARAMETER_SECURITY, "/sec:", false, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//    settingsAddKey(PARAMETER_SECURITY_TLS, "-authentication", false, true);
 | 
				
			||||||
 | 
					//    settingsAddKey(PARAMETER_SECURITY_RDP, "-authentication", false, true);
 | 
				
			||||||
 | 
					//    settingsAddKey(PARAMETER_SECURITY_NLA, "-authentication", false, true);
 | 
				
			||||||
 | 
					//    settingsAddKey(PARAMETER_SECURITY_EXT, "-authentication", false, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Arguments *buildArguments()
 | 
					Arguments *buildArguments()
 | 
				
			||||||
| 
						 | 
					@ -43,7 +51,8 @@ Arguments *buildArguments()
 | 
				
			||||||
    return args;
 | 
					    return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void freeArguments()
 | 
					void freeArguments(Arguments *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    free(args->argv);
 | 
				
			||||||
 | 
					    free(args);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,6 @@
 | 
				
			||||||
#ifndef ARGUMENTS_H_
 | 
					#ifndef ARGUMENTS_H_
 | 
				
			||||||
#define ARGUMENTS_H_
 | 
					#define ARGUMENTS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "node_settings.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct
 | 
					typedef struct
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int argc;
 | 
					    int argc;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										29
									
								
								gui.c
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								gui.c
									
										
									
									
									
								
							| 
						 | 
					@ -33,32 +33,7 @@ static int guiConnect(Ihandle *self)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    printf("\n");
 | 
					    printf("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    freeArguments(args);
 | 
				
			||||||
//    char *program = "xfreerdp";
 | 
					 | 
				
			||||||
//    char *domain = "/d:agrohold";
 | 
					 | 
				
			||||||
//    char *certignore = "/cert-ignore";
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//    char **argv = (char**) malloc(sizeof(char*) * 8);
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//    argv[0] = program;
 | 
					 | 
				
			||||||
//    argv[1] = server;
 | 
					 | 
				
			||||||
//    argv[2] = domain;
 | 
					 | 
				
			||||||
//    argv[3] = user;
 | 
					 | 
				
			||||||
//    argv[4] = password;
 | 
					 | 
				
			||||||
//    argv[5] = certignore;
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//    Ihandle *child = IupGetDialogChild(self, "SETTINGS_WINDOW");
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//    if (!strcmp(IupGetAttribute(IupGetDialogChild(child, "SETTINGS_FULLSCREEN"), "VALUE"), "ON"))
 | 
					 | 
				
			||||||
//    {
 | 
					 | 
				
			||||||
//        argv[6] = "/f\0";
 | 
					 | 
				
			||||||
//    }
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//    if (!strcmp(IupGetAttribute(IupGetDialogChild(child, "SETTINGS_MULTIMONITOR"), "VALUE"), "ON"))
 | 
					 | 
				
			||||||
//    {
 | 
					 | 
				
			||||||
//        argv[7] = "/multimon\0";
 | 
					 | 
				
			||||||
//    }
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return IUP_DEFAULT;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -135,7 +110,7 @@ Ihandle* guiStart()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IupSetCallback(btnConnect, "ACTION", (Icallback) guiConnect);
 | 
					    IupSetCallback(btnConnect, "ACTION", (Icallback) guiConnect);
 | 
				
			||||||
    IupSetCallback(btnClose, "ACTION", (Icallback) guiExit);
 | 
					    IupSetCallback(btnClose, "ACTION", (Icallback) guiExit);
 | 
				
			||||||
    IupSetCallback(btnSettings, "ACTION", (Icallback) settingsWindow);
 | 
					    IupSetCallback(btnSettings, "ACTION", (Icallback) settingsMainWindow);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dlg = IupDialog(vBoxMain);
 | 
					    dlg = IupDialog(vBoxMain);
 | 
				
			||||||
    IupSetAttribute(dlg, "IMAGE", "BG_HEAD");
 | 
					    IupSetAttribute(dlg, "IMAGE", "BG_HEAD");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,6 +65,7 @@ void settingsAddKey(SettingsParameters parameter, char *key, bool isValue, bool
 | 
				
			||||||
    Node *newNode = settingsCreateNode();
 | 
					    Node *newNode = settingsCreateNode();
 | 
				
			||||||
    newNode->parameter = parameter;
 | 
					    newNode->parameter = parameter;
 | 
				
			||||||
    newNode->enable = enable;
 | 
					    newNode->enable = enable;
 | 
				
			||||||
 | 
					    newNode->change = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SettingsData *data = newNode->data;
 | 
					    SettingsData *data = newNode->data;
 | 
				
			||||||
    data->isValue = isValue;
 | 
					    data->isValue = isValue;
 | 
				
			||||||
| 
						 | 
					@ -160,6 +161,58 @@ void settingsToggleEnable(SettingsParameters parameter)
 | 
				
			||||||
    currentNode->enable = !currentNode->enable;
 | 
					    currentNode->enable = !currentNode->enable;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void settingsToggleChange(SettingsParameters parameter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Node *currentNode = settingsGetNode(parameter);
 | 
				
			||||||
 | 
					    if (!currentNode)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    currentNode->change = !currentNode->change;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void settingsResetChange()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!settings.countAll)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (Node *head = settings.next; head; head = head->next)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (head->change)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            head->change = false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void settingsSaveSettings()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!settings.countAll)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (Node *head = settings.next; head; head = head->next)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (head->change)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            head->change = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (head->enable)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                --settings.countEnable;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                ++settings.countEnable;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            head->enable = !head->enable;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool settingsGetEnable(SettingsParameters parameter)
 | 
					bool settingsGetEnable(SettingsParameters parameter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Node *currentNode = settingsGetNode(parameter);
 | 
					    Node *currentNode = settingsGetNode(parameter);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,15 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef enum
 | 
					typedef enum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PARAMETER_NULL, PARAMETER_XFREERDP, PARAMETER_USERNAME, PARAMETER_SERVER, PARAMETER_PASSWORD, PARAMETER_MULTIMONITOR, PARAMETER_FULLSCREEN
 | 
					    PARAMETER_NULL,
 | 
				
			||||||
 | 
					    PARAMETER_XFREERDP,
 | 
				
			||||||
 | 
					    PARAMETER_USERNAME,
 | 
				
			||||||
 | 
					    PARAMETER_SERVER,
 | 
				
			||||||
 | 
					    PARAMETER_PASSWORD,
 | 
				
			||||||
 | 
					    PARAMETER_MULTIMONITOR,
 | 
				
			||||||
 | 
					    PARAMETER_FULLSCREEN,
 | 
				
			||||||
 | 
					    PARAMETER_AUTHENTICATION,
 | 
				
			||||||
 | 
					    PARAMETER_SECURITY
 | 
				
			||||||
} SettingsParameters;
 | 
					} SettingsParameters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct
 | 
					typedef struct
 | 
				
			||||||
| 
						 | 
					@ -26,6 +34,7 @@ typedef struct
 | 
				
			||||||
typedef struct Node
 | 
					typedef struct Node
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SettingsParameters parameter;
 | 
					    SettingsParameters parameter;
 | 
				
			||||||
 | 
					    bool change;
 | 
				
			||||||
    bool enable;
 | 
					    bool enable;
 | 
				
			||||||
    SettingsData *data;
 | 
					    SettingsData *data;
 | 
				
			||||||
    struct Node *next;
 | 
					    struct Node *next;
 | 
				
			||||||
| 
						 | 
					@ -49,7 +58,10 @@ void settingsAddKey(SettingsParameters parameter, char *key, bool isValue, bool
 | 
				
			||||||
void settingsSetValue(SettingsParameters parameter, char *value);
 | 
					void settingsSetValue(SettingsParameters parameter, char *value);
 | 
				
			||||||
void settingsSetEnable(SettingsParameters parameter, bool enable);
 | 
					void settingsSetEnable(SettingsParameters parameter, bool enable);
 | 
				
			||||||
void settingsToggleEnable(SettingsParameters parameter);
 | 
					void settingsToggleEnable(SettingsParameters parameter);
 | 
				
			||||||
 | 
					void settingsToggleChange(SettingsParameters parameter);
 | 
				
			||||||
bool settingsGetEnable(SettingsParameters parameter);
 | 
					bool settingsGetEnable(SettingsParameters parameter);
 | 
				
			||||||
void settingsFree();
 | 
					void settingsFree();
 | 
				
			||||||
 | 
					void settingsSaveSettings();
 | 
				
			||||||
 | 
					void settingsResetChange();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* SETTINGS_H_ */
 | 
					#endif /* SETTINGS_H_ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										172
									
								
								settings.c
									
										
									
									
									
								
							
							
						
						
									
										172
									
								
								settings.c
									
										
									
									
									
								
							| 
						 | 
					@ -6,83 +6,169 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <iup.h>
 | 
					#include <iup.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "settings.h"
 | 
					#include "settings.h"
 | 
				
			||||||
#include "arguments.h"
 | 
					#include "arguments.h"
 | 
				
			||||||
 | 
					#include "node_settings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int settingsClose(Ihandle *bt_close)
 | 
					static int settingsClose(Ihandle *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    IupSetAttribute(IupGetDialog(bt_close), "SIMULATEMODAL", "OFF");
 | 
					    settingsResetChange();
 | 
				
			||||||
    IupHide(IupGetDialog(bt_close));
 | 
					    IupSetAttribute(IupGetDialog(self), "SIMULATEMODAL", "OFF");
 | 
				
			||||||
 | 
					    IupHide(IupGetDialog(self));
 | 
				
			||||||
    return IUP_DEFAULT;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int settingsSave(Ihandle *self)
 | 
					static int settingsSave(Ihandle *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    settingsSaveSettings();
 | 
				
			||||||
 | 
					    IupSetAttribute(IupGetDialog(self), "SIMULATEMODAL", "OFF");
 | 
				
			||||||
 | 
					    IupHide(IupGetDialog(self));
 | 
				
			||||||
    return IUP_DEFAULT;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int settingsTglMultimonitor(Ihandle *self)
 | 
					static int settingsTglMultimonitor(Ihandle *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    settingsToggleEnable(PARAMETER_MULTIMONITOR);
 | 
					    settingsToggleChange(PARAMETER_MULTIMONITOR);
 | 
				
			||||||
    return IUP_DEFAULT;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int settingsTglFullscreen(Ihandle *self)
 | 
					static int settingsTglFullscreen(Ihandle *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    settingsToggleEnable(PARAMETER_FULLSCREEN);
 | 
					    settingsToggleChange(PARAMETER_FULLSCREEN);
 | 
				
			||||||
    return IUP_DEFAULT;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int settingsWindow(Ihandle *self)
 | 
					static int settingsTglAuthentication(Ihandle *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Ihandle *dlg;
 | 
					    settingsToggleChange(PARAMETER_AUTHENTICATION);
 | 
				
			||||||
    Ihandle *vBoxMain, *hBoxToggles, *hSettingsBoxButtons;
 | 
					    return IUP_DEFAULT;
 | 
				
			||||||
    Ihandle *btnSettingsClose, *btnSettingsSave;
 | 
					}
 | 
				
			||||||
    Ihandle *tglMultimonitor, *tglFullscreen;
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Блок настроек
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static Ihandle* getFrmCheckbox()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Ihandle *tglMultimonitor, *tglFullscreen, *tglAuthentication;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tglMultimonitor = IupToggle("Мультиэкран", NULL);
 | 
					    tglMultimonitor = IupToggle("Мультиэкран", NULL);
 | 
				
			||||||
    IupSetAttribute(tglMultimonitor, "VALUE", (settingsGetEnable(PARAMETER_MULTIMONITOR) ? "ON" : "OFF"));
 | 
					 | 
				
			||||||
    IupSetAttribute(tglMultimonitor, "NAME", "SETTINGS_MULTIMONITOR");
 | 
					 | 
				
			||||||
    tglFullscreen = IupToggle("На весь экран", NULL);
 | 
					    tglFullscreen = IupToggle("На весь экран", NULL);
 | 
				
			||||||
    IupSetAttribute(tglFullscreen, "NAME", "SETTINGS_FULLSCREEN");
 | 
					    tglAuthentication = IupToggle("Аутентификация", NULL);
 | 
				
			||||||
    IupSetAttribute(tglFullscreen, "VALUE", (settingsGetEnable(PARAMETER_FULLSCREEN) ? "ON" : "OFF"));
 | 
					 | 
				
			||||||
    hBoxToggles = IupHbox(IupFill(), tglFullscreen, tglMultimonitor, IupFill(), NULL);
 | 
					 | 
				
			||||||
    IupSetAttribute(hBoxToggles, "GAP", "10");
 | 
					 | 
				
			||||||
    IupSetAttribute(hBoxToggles, "MARGIN", "10x10");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    btnSettingsSave = IupButton("Сохранить", NULL);
 | 
					    IupSetInt(tglMultimonitor, "VALUE", settingsGetEnable(PARAMETER_MULTIMONITOR));
 | 
				
			||||||
    IupSetAttribute(btnSettingsSave, "NAME", "SETTIGS_SAVE");
 | 
					    IupSetInt(tglFullscreen, "VALUE", settingsGetEnable(PARAMETER_FULLSCREEN));
 | 
				
			||||||
    btnSettingsClose = IupButton("Закрыть", NULL);
 | 
					    IupSetInt(tglAuthentication, "VALUE", settingsGetEnable(PARAMETER_AUTHENTICATION));
 | 
				
			||||||
    IupSetHandle("SETTIGS_CLOSE", btnSettingsClose);
 | 
					 | 
				
			||||||
    IupSetAttribute(btnSettingsClose, "NAME", "SETTIGS_CLOSE");
 | 
					 | 
				
			||||||
    hSettingsBoxButtons = IupHbox(IupFill(), btnSettingsClose, btnSettingsSave, IupFill(), NULL);
 | 
					 | 
				
			||||||
    IupSetAttribute(hSettingsBoxButtons, "ALIGNMENT", "ACENTER:ACENTER");
 | 
					 | 
				
			||||||
    IupSetAttribute(hSettingsBoxButtons, "GAP", "10");
 | 
					 | 
				
			||||||
    IupSetAttribute(hSettingsBoxButtons, "MARGIN", "10x10");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vBoxMain = IupVbox(hBoxToggles, hSettingsBoxButtons, NULL);
 | 
					    return IupVbox(
 | 
				
			||||||
 | 
					            IupSetCallbacks(IupSetAttributes(tglMultimonitor, "NAME=SETTINGS_TGL_MULTIMONITOR"), "ACTION",
 | 
				
			||||||
 | 
					                    (Icallback) settingsTglMultimonitor, NULL),
 | 
				
			||||||
 | 
					            IupSetCallbacks(IupSetAttributes(tglFullscreen, "NAME=SETTINGS_TGL_FULLSCREEN"), "ACTION",
 | 
				
			||||||
 | 
					                    (Icallback) settingsTglFullscreen, NULL),
 | 
				
			||||||
 | 
					            IupSetCallbacks(IupSetAttributes(tglAuthentication, "NAME=SETTINGS_TGL_AUTHENTICATION"), "ACTION",
 | 
				
			||||||
 | 
					                                                (Icallback) settingsTglAuthentication, NULL),
 | 
				
			||||||
 | 
					            NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//void tool_action_cb(Ihandle *self, int state)
 | 
				
			||||||
 | 
					//{
 | 
				
			||||||
 | 
					//    if (state == 1)
 | 
				
			||||||
 | 
					//    {
 | 
				
			||||||
 | 
					//        int tool_index = IupGetInt(self, "TOOLINDEX");
 | 
				
			||||||
 | 
					//        switch (tool_index)
 | 
				
			||||||
 | 
					//        {
 | 
				
			||||||
 | 
					//        case 0:
 | 
				
			||||||
 | 
					//        {
 | 
				
			||||||
 | 
					//            settingsSetValue(PARAMETER_SECURITY, "tls");
 | 
				
			||||||
 | 
					//            break;
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//        case 1:
 | 
				
			||||||
 | 
					//        {
 | 
				
			||||||
 | 
					//            settingsSetValue(PARAMETER_SECURITY, "rdp");
 | 
				
			||||||
 | 
					//            break;
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//        case 2:
 | 
				
			||||||
 | 
					//        {
 | 
				
			||||||
 | 
					//            settingsSetValue(PARAMETER_SECURITY, "nla");
 | 
				
			||||||
 | 
					//            break;
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//        case 3:
 | 
				
			||||||
 | 
					//        {
 | 
				
			||||||
 | 
					//            settingsSetValue(PARAMETER_SECURITY, "ext");
 | 
				
			||||||
 | 
					//            break;
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//static Ihandle* getFrmSecurity()
 | 
				
			||||||
 | 
					//{
 | 
				
			||||||
 | 
					//    Ihandle *frmSettings;
 | 
				
			||||||
 | 
					//    Ihandle *grdSecurity;
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    grdSecurity = IupGridBox(
 | 
				
			||||||
 | 
					//            IupSetCallbacks(IupSetAttributes(IupToggle(NULL, NULL), "TITLE=TLS, TOOLINDEX=0, VALUE=ON"), "ACTION", (Icallback)tool_action_cb, NULL),
 | 
				
			||||||
 | 
					//            IupSetCallbacks(IupSetAttributes(IupToggle(NULL, NULL), "TITLE=RDP, TOOLINDEX=1"), "ACTION", (Icallback)tool_action_cb, NULL),
 | 
				
			||||||
 | 
					//            IupSetCallbacks(IupSetAttributes(IupToggle(NULL, NULL), "TITLE=NLA, TOOLINDEX=2"), "ACTION", (Icallback)tool_action_cb, NULL),
 | 
				
			||||||
 | 
					//            IupSetCallbacks(IupSetAttributes(IupToggle(NULL, NULL), "TITLE=EXT, TOOLINDEX=3"), "ACTION", (Icallback)tool_action_cb, NULL),
 | 
				
			||||||
 | 
					//            NULL);
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					////    tglTLS = IupToggle("TLS", NULL);
 | 
				
			||||||
 | 
					////    tglRDP = IupToggle("RDP", NULL);
 | 
				
			||||||
 | 
					////    tglNLA = IupToggle("NLA", NULL);
 | 
				
			||||||
 | 
					////    tglEXT = IupToggle("EXT", NULL);
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    frmSettings = IupSetAttributes(IupFrame(IupSetAttributes(getFrmCheckbox(), "MARGIN=3x2, GAP=2, ALIGNMENT=ALEFT")), "TITLE=\"Настройки\"");
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    return frmSettings;
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static Ihandle* getHorBoxSettings()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Ihandle *frmSettings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    frmSettings = IupSetAttributes(IupFrame(IupSetAttributes(getFrmCheckbox(), "MARGIN=3x2, GAP=2, ALIGNMENT=ALEFT")), "TITLE=\"Настройки\"");
 | 
				
			||||||
 | 
					    return IupHbox(frmSettings, NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Блок кнопок
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static Ihandle* getHorBoxButtons()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Ihandle *btnSave, *btnClose;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    btnSave = IupButton("Сохранить", NULL);
 | 
				
			||||||
 | 
					    IupSetAttribute(btnSave, "NAME", "SETTIGS_BTN_SAVE");
 | 
				
			||||||
 | 
					    IupSetAttribute(btnSave, "TIP", "Сохранить настройки");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    btnClose = IupButton("Закрыть", NULL);
 | 
				
			||||||
 | 
					    IupSetAttribute(btnClose, "NAME", "SETTIGS_BTN_CLOSE");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vBoxMain = IupSetAttributes(IupVbox(getHorBoxSettings(), getHorBoxButtons(), NULL), "NMARGIN=2x2, ALIGNMENT=ACENTER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dlg = IupDialog(vBoxMain);
 | 
					    dlg = IupDialog(vBoxMain);
 | 
				
			||||||
    IupSetAttribute(dlg, "TITLE", "Настройки");
 | 
					    IupSetAttribute(dlg, "TITLE", "Настройки");
 | 
				
			||||||
    IupSetAttribute(dlg, "ICON", "icon");
 | 
					    IupSetCallback(
 | 
				
			||||||
    IupSetAttribute(dlg, "DIALOGFRAME", "ON");
 | 
					            IupSetAttributes(dlg,
 | 
				
			||||||
    IupSetAttribute(dlg, "SIMULATEMODAL", "ON");
 | 
					                    "ICON=icon, DIALOGFRAME=ON, SIMULATEMODAL=ON, DEFAULTESC=btnClosePointer, TOPMOST=YES, BRINGFRONT=YES, NAME=SETTINGS_MAIN_WINDOW"),
 | 
				
			||||||
    IupSetAttribute(dlg, "DEFAULTESC", "SETTIGS_CLOSE");
 | 
					            "CLOSE_CB", (Icallback) settingsClose);
 | 
				
			||||||
    IupSetAttribute(dlg, "TOPMOST", "YES");
 | 
					 | 
				
			||||||
    IupSetAttribute(dlg, "BRINGFRONT", "YES");
 | 
					 | 
				
			||||||
    IupSetAttribute(dlg, "NAME", "SETTINGS_WINDOW");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IupSetCallback(dlg, "CLOSE_CB", (Icallback) settingsClose);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//    IupSetAttribute(dlg, "RESIZE", "NO");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    IupSetCallback(btnSettingsClose, "ACTION", (Icallback) settingsClose);
 | 
					 | 
				
			||||||
    IupSetCallback(btnSettingsSave, "ACTION", (Icallback) settingsSave);
 | 
					 | 
				
			||||||
    IupSetCallback(tglFullscreen, "ACTION", (Icallback) settingsTglFullscreen);
 | 
					 | 
				
			||||||
    IupSetCallback(tglMultimonitor, "ACTION", (Icallback) settingsTglMultimonitor);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IupShowXY(dlg, IUP_CURRENT, IUP_CURRENT);
 | 
					    IupShowXY(dlg, IUP_CURRENT, IUP_CURRENT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,6 @@
 | 
				
			||||||
#ifndef SETTINGS_H_
 | 
					#ifndef SETTINGS_H_
 | 
				
			||||||
#define SETTINGS_H_
 | 
					#define SETTINGS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int settingsWindow(Ihandle *self);
 | 
					int settingsMainWindow(Ihandle *self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* SETTINGS_H_ */
 | 
					#endif /* SETTINGS_H_ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue