Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions IDE/Contents/Include/SettingsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,28 @@ class SettingsWindow : public UIWindow {
void handleEvent(Event *event);
void updateUI();

/**
* Set the key properties
* @param keyString String of the selected label
* @return int describing which keys you use
*/
int setKeyProp(String keyString);

UITab *keys, *general;
UITabFrame *tabFrame;

UIElement *rootGeneral;
UICheckBox *useExternalTextEditorBox;
UITextInput *externalTextEditorCommand;
UIButton *browseButton;
UIComboBox *syntaxThemeBox;
UIComboBox *uiThemeBox;
UIComboBox *textureFilteringBox;

UIElement *rootKeys;
UIComboBox *keyPan;
UIComboBox *keyRot;
UIComboBox *keyZoom;

UIButton *cancelButton;
UIButton *okButton;
Expand Down
8 changes: 7 additions & 1 deletion IDE/Contents/Include/TrackballCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ class TrackballCamera : public EventDispatcher {


void setCameraPosition(Vector3 cameraPosition);


/**
* Function to check if the keys needed for an action (like zooming)
* @param actionKey String with keyPan, keyRot or keyZoom for the saved key to return
* @return true if all keys for this action are down
*/
bool isActionKeyDown(String actionKey);
bool isNavKeyDown();

void disableRotation(bool val);
Expand Down
40 changes: 35 additions & 5 deletions IDE/Contents/Source/PolycodeIDEApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,11 @@ void PolycodeIDEApp::saveConfigFile() {
ObjectEntry *textEditorEntry = configFile.root["settings"]->addChild("text_editor");
textEditorEntry->addChild("use_external", config->getStringValue("Polycode", "useExternalTextEditor"));
textEditorEntry->addChild("command", config->getStringValue("Polycode", "externalTextEditorCommand"));

ObjectEntry *keysEntry = configFile.root["settings"]->addChild("keys");
keysEntry->addChild("key_pan", config->getNumericValue("Polycode", "keyPan"));
keysEntry->addChild("key_rot", config->getNumericValue("Polycode", "keyRot"));
keysEntry->addChild("key_zoom", config->getNumericValue("Polycode", "keyZoom"));

#if defined(__APPLE__) && defined(__MACH__)
core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
Expand Down Expand Up @@ -1240,25 +1245,50 @@ void PolycodeIDEApp::loadConfigFile() {
}
}

if(configFile.root["settings"]) {
if (configFile.root["settings"]) {
ObjectEntry *settings = configFile.root["settings"];
ObjectEntry *textEditor = (*settings)["text_editor"];
if(textEditor) {
if((*textEditor)["use_external"]) {
ObjectEntry *keysEntry = (*settings)["keys"];
if (textEditor) {
if ((*textEditor)["use_external"]) {
config->setStringValue("Polycode", "useExternalTextEditor", (*textEditor)["use_external"]->stringVal);
} else {
config->setStringValue("Polycode", "useExternalTextEditor", "false");
}

if((*textEditor)["command"]) {
if ((*textEditor)["command"]) {
config->setStringValue("Polycode", "externalTextEditorCommand", (*textEditor)["command"]->stringVal);
} else {
config->setStringValue("Polycode", "externalTextEditorCommand", "");
}
}
if (keysEntry){
if ((*keysEntry)["key_pan"]){
config->setNumericValue("Polycode", "keyPan", (*keysEntry)["key_pan"]->NumberVal);
} else {
config->setNumericValue("Polycode", "keyPan", 5);
}
if ((*keysEntry)["key_rot"]){
config->setNumericValue("Polycode", "keyRot", (*keysEntry)["key_rot"]->NumberVal);
} else {
config->setNumericValue("Polycode", "keyRot", 0);
}
if ((*keysEntry)["key_zoom"]){
config->setNumericValue("Polycode", "keyZoom", (*keysEntry)["key_zoom"]->NumberVal);
} else {
config->setNumericValue("Polycode", "keyZoom", 6);
}
} else {
config->setNumericValue("Polycode", "keyPan", 5);
config->setNumericValue("Polycode", "keyRot", 0);
config->setNumericValue("Polycode", "keyZoom", 6);
}
} else {
config->setStringValue("Polycode","useExternalTextEditor", "false");
config->setStringValue("Polycode", "useExternalTextEditor", "false");
config->setStringValue("Polycode", "externalTextEditorCommand", "");
config->setNumericValue("Polycode", "keyPan", 5);
config->setNumericValue("Polycode", "keyRot", 0);
config->setNumericValue("Polycode", "keyZoom", 6);
}
}

Expand Down
Loading