📄 properties.h
字号:
// Copyright (C) 2006 Teamviewer GmbH. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of TeamViewer.
//
// TeamViewer is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for TeamViewer is not available from the place
// whence you received this file, check http://www.teamviewer.com
// for information on obtaining it.
// vncProperties
// Object implementing the Properties dialog for WinVNC.
// The Properties dialog is displayed whenever the user selects 'Options' from the menu
// or from the system tray menu.
// The Properties dialog also takes care of loading the program
// settings and saving them on exit.
class vncProperties;
#if (!defined(_WINVNC_VNCPROPERTIES))
#define _WINVNC_VNCPROPERTIES
#include "vncServer.h"
#include "teamviewerinfo.h"
#define MAX_INVITATION_TEXT_LEN 512
#define MAX_SUBJECT_STRING_LEN 128
// The vncProperties class itself
class vncProperties
{
public:
// TRAY ICON MENU SETTINGS
bool Lock_service_helper;
private:
// The server object to which this properties object is attached.
vncServer *m_server;
bool m_dlgvisible;
void EnableServerMode(HWND hwnd,bool enable);
static bool EnableApply(UINT wParam, HWND hwnd);
static BOOL NotifyProc(HWND hwnd, UINT code, LONG (vncProperties::*verifyFunc)(HWND), LONG (vncProperties::*applyFunc)(HWND));
static void TimerProc(HWND hwnd, int idc);
//void ApplyQuality(int qual, int *enc, int *col, bool *wall);
public:
// Constructor/destructor
vncProperties();
~vncProperties();
// Initialisation
BOOL Init(vncServer *server);
// Display the properties dialog
// If usersettings is TRUE then the per-user settings come up
// If usersettings is FALSE then the default system settings come up
void ShowAdmin(BOOL show, BOOL usersettings,int startPage=0);
int InitDialog(HWND hBasic,HWND hAdvanced,vncProperties* _this);
// Loading & saving of preferences
void Load();
//void ResetRegistry();
void Save();
// save settings for installation in host mode
void SaveHostMode(int autostart, const char* passwd);
static char * LoadString(HKEY k, LPCSTR valname);
int ShowPropertiesDialog(int startPage=0);
static vncProperties* singleton;
BOOL AllowProperties() { return m_pref_Security_AdminOnly; }
BOOL AllowShutdown() { return m_server->AutostartSetting() == 0 || m_pref_Host_AllowShutdown; }
BOOL AllowEditClients() { return m_pref_Security_AdminOnly; }
bool GeneralUseDynGate() { return m_pref_General_UseDynGate; }
int Remote_Quality() { return m_pref_Remote_Quality; }
int Remote_Compression() { return m_pref_Remote_Compression; }
int Remote_Colors() { return m_pref_Remote_Colors; }
int Remote_ServerScale() { return m_pref_Remote_ServerScale; }
bool Remote_ViewOnly() { return m_pref_Remote_ViewOnly; }
bool Remote_RemoveWallpaper() { return m_pref_Remote_Wallpaper; }
bool Remote_DisableInput() { return m_pref_Remote_DisableInput; }
bool Remote_BlackScreen() { return m_pref_Remote_BlackScreen; }
bool Remote_Scaling() { return m_pref_Remote_Scaling; }
bool Remote_Autoscaling() { return m_pref_Remote_Autoscaling; }
int Remote_ScaleBy() { return m_pref_Remote_ScaleBy; }
bool Remote_ShowRemoteCursor() {return m_pref_Remote_ShowRemoteCursor; }
int Presentation_Quality() { return m_pref_Presentation_Quality; }
int Presentation_Compression() { return m_pref_Presentation_Compression; }
int Presentation_Colors() { return m_pref_Presentation_Colors; }
int Presentation_ServerScale() { return m_pref_Presentation_ServerScale; }
bool Presentation_SingleWindow() { return m_pref_Presentation_SingleWindow; }
char* Presentation_WindowName() { return m_pref_Presentation_WindowNamed; }
bool Presentation_RemoveWallpaper() { return m_pref_Presentation_Wallpaper; }
std::string CustomInvitation_Subject() {return m_pref_CustomInvitation_Subject;}
std::string CustomInvitation_Text() {return m_pref_CustomInvitation_Text;}
/*
Properties_Location contains the actual location of settings in registry.
return HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE or 0 if settings cannot be saved or loaded.
*/
HKEY Properties_Location() {return m_Properties_Location;}
void SetConnectionMode(ConnectionMode newmode)
{
m_connectionMode = newmode;
}
ConnectionMode GetConnectionMode()
{
return m_connectionMode;
}
protected:
// Registry access
// Password handling
void LoadPassword(HKEY k, char *buffer);
void SavePassword(HKEY k, char *buffer);
// Manipulate the registry settings
LONG LoadInt(HKEY key, LPCSTR valname, LONG defval);
void SaveInt(HKEY key, LPCSTR valname, LONG val);
// String handling
bool LoadString(HKEY key, LPCSTR keyname, char* dest, int maxlen);
static void SaveString(HKEY key,LPCSTR valname, TCHAR *buffer);
// Loading/saving all the user prefs
void LoadUserPrefs(HKEY appkey);
void SaveUserPrefs(HKEY appkey);
// Loading/saving the machine prefs
void LoadMachinePrefs(HKEY appkey);
void SaveMachinePrefs(HKEY appkey);
// Making the loaded user prefs active
void ApplyPrefs();
// reset the cached properties
void vncProperties::ResetProperties();
// Dialog functions
void InitGeneralDialog(HWND hBasic);
void InitRemoteDialog(HWND hRemote);
void InitPresentationDialog(HWND hPres);
void InitSecurityDialog(HWND hSecurity);
void InitHostDialog(HWND hHost);
void InitInvitationDialog(HWND hInvitation);
LONG VerifyRemote(HWND hRemote);
LONG VerifyPresentation(HWND hPres);
LONG VerifyHost(HWND hHost);
LONG ApplyGeneral(HWND hBasic);
LONG ApplyRemote(HWND hRemote);
LONG ApplyPresentation(HWND hPres);
LONG ApplySecurity(HWND hSecurity);
LONG ApplyHost(HWND hHost);
LONG ApplyInvitation(HWND hHost);
/*
ConvertHTML2CInvitation replaces all "%0D" occurrences with "\r\n" and
also removes all %0A occurrences in m_pref_CustomInvitation_Text.
*/
void ConvertHTML2CInvitation();
/*
ConvertC2HTMLInvitation replaces all "\n" occurrences with "%0A" and
all "\r" occurrences with "%0D" in m_pref_CustomInvitation_Text.
*/
void ConvertC2HTMLInvitation();
static BOOL APIENTRY GeneralProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
static BOOL APIENTRY RemoteProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
static BOOL APIENTRY PresentationProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
static BOOL APIENTRY SecurityProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
static BOOL APIENTRY HostProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
static BOOL APIENTRY InviteProc(HWND hDlg,UINT message,UINT wParam,LONG lParam);
map<HWND, char*> helptexts;
bool isAdmin;
ConnectionMode m_connectionMode;
// General properties
bool m_pref_General_UseDynGate;
char m_pref_General_Identity[MAXIDENTITYLEN];
bool m_pref_General_Logging;
bool m_pref_General_ConnectionLogging;
// Remote control properties
int m_pref_Remote_Quality;
int m_pref_Remote_Compression;
int m_pref_Remote_Colors;
int m_pref_Remote_ServerScale;
bool m_pref_Remote_ViewOnly;
bool m_pref_Remote_Wallpaper;
bool m_pref_Remote_DisableInput;
bool m_pref_Remote_BlackScreen;
bool m_pref_Remote_Scaling;
bool m_pref_Remote_Autoscaling;
int m_pref_Remote_ScaleBy;
bool m_pref_Remote_ShowRemoteCursor;
// Presentation properties
int m_pref_Presentation_Quality;
int m_pref_Presentation_Compression;
int m_pref_Presentation_Colors;
bool m_pref_Presentation_Wallpaper;
int m_pref_Presentation_ServerScale;
bool m_pref_Presentation_SingleWindow;
char m_pref_Presentation_WindowNamed[MAX_SW_NAMELEN];
// Custom invitation
//char m_pref_CustomInvitation_Subject[MAX_SUBJECT_STRING_LEN];
std::string m_pref_CustomInvitation_Subject;
std::string m_pref_CustomInvitation_Text;
//char m_pref_CustomInvitation_Text[MAX_INVITATION_TEXT_LEN];
// Security properties
bool m_pref_Security_AdminOnly;
bool m_pref_Security_AllowIncoming;
bool m_pref_Security_AllowDisableInput;
bool m_pref_Security_AllowInput;
int m_pref_Security_EnableFileTransfer;
int m_pref_Security_LockSettings;
int m_pref_Security_Multiple;
bool m_pref_Security_SingleWindow;
char m_pref_Security_ShareWindowNamed[MAX_SW_NAMELEN];
bool m_pref_Security_VNC_Compat;
// Host properties
bool m_pref_Host_AllowShutdown;
int m_pref_Host_Autostart;
char m_pref_Host_Passwd[MAXPWLEN];
HKEY m_Properties_Location;
};
#endif // _WINVNC_VNCPROPERTIES
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -