Skip to content

Commit

Permalink
InfoListWnd Basis
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinFan committed Jul 28, 2020
1 parent 1cb8421 commit 4099e75
Show file tree
Hide file tree
Showing 13 changed files with 309 additions and 1,245 deletions.
2 changes: 2 additions & 0 deletions Include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ constexpr int LT_NEW_VER_CHECK_TIME = 48; // [h] between two checks of a new
#define XPPRF_RENOPT_HDR_ANTIAL "renopt_HDR_antial"

//MARK: Menu Items
#define MENU_INFO_LIST_WND "Status / Information..."
#define MENU_AC_INFO_WND "Aircraft Info..."
#define MENU_AC_INFO_WND_POPOUT "Aircraft Info... (Popped out)"
#define MENU_AC_INFO_WND_SHOWN "Aircraft Info shown"
Expand Down Expand Up @@ -239,6 +240,7 @@ constexpr int LT_NEW_VER_CHECK_TIME = 48; // [h] between two checks of a new
#define HELP_SET_ADVANCED "setup/configuration/settings-advanced"
#define HELP_SET_CSL "setup/configuration/settings-csl"
#define HELP_SET_DEBUG "setup/configuration/settings-debug"
#define HELP_ILW "using-lt/info-list-window"

//MARK: File Paths
// these are under the plugins directory
Expand Down
5 changes: 5 additions & 0 deletions Include/DataRefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ enum dataRefsLT {
DR_UI_ACI_HEIGHT,
DR_UI_ACI_COLLAPSED,
DR_UI_ACI_FONT_SCALE,
DR_UI_ILW_WIDTH,
DR_UI_ILW_HEIGHT,

// configuration options
DR_CFG_AIRCRAFT_DISPLAYED,
Expand Down Expand Up @@ -564,6 +566,9 @@ class DataRefs
int ACIcollapsed = 0; ///< A/C Info Wnd collapsed sections status
int ACIfontScale = DEF_UI_FONT_SCALE; ///< [%] Font scale

int ILWwidth = 500; ///< Info List Wnd width
int ILWheight = 300; ///< Info List Wnd height

//MARK: Constructor
public:
DataRefs ( logLevelTy initLogLevel ); // Constructor doesn't do much
Expand Down
62 changes: 62 additions & 0 deletions Include/InfoListWnd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/// @file InfoListWnd.h
/// @brief Window listing aircraft, messages, and status information
/// @author Birger Hoppe
/// @copyright (c) 2018-2020 Birger Hoppe
/// @copyright Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:\n
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.\n
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.

#ifndef InfoListWnd_h
#define InfoListWnd_h

//
// Info List Window
//
class InfoListWnd : public LTImgWindow
{
protected:
enum ILWTabTy { ILW_TAB_NONE=0, ILW_TAB_AC_LIST, ILW_TAB_MSG, ILW_TAB_STATUS };
ILWTabTy activeTab = ILW_TAB_NONE;
std::string wndTitle; ///< current window title, contains opened tab

public:
/// Constructor shows the window
/// @param _mode (optional) window mode, defaults to "float or VR"
InfoListWnd(WndMode _mode = WND_MODE_FLOAT_OR_VR);
/// Desctructor cleans up
~InfoListWnd() override;

/// Redefine the window title based on the (now) active tab
void TabActive (ILWTabTy _tab);
/// Return the text to be used as window title
std::string GetWndTitle () const { return wndTitle; }

protected:
/// Some setup before UI building starts, here text size calculations
ImGuiWindowFlags_ beforeBegin() override;
/// Main function to render the window's interface
void buildInterface() override;

// A set of static functions to create/administer the windows
public:
/// @brief Creates/opens/displays/hides/closes the info list window
/// @param _force 0 - toggle, <0 force close, >0 force open
/// @return Is displayed now?
static bool ToggleDisplay (int _force = 0);
/// Is the settings window currently displayed?
static bool IsDisplayed ();
};

#endif /* InfoListWnd_h */
1 change: 1 addition & 0 deletions Include/LiveTraffic.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ extern DataRefs dataRefs;
#include "LTImgWindow.h"
#include "SettingsUI.h"
#include "ACInfoWnd.h"
#include "InfoListWnd.h"
#include "LTApt.h"

// LiveTraffic channels
Expand Down
147 changes: 0 additions & 147 deletions Include/SettingsUI - TFWidgets.h

This file was deleted.

7 changes: 0 additions & 7 deletions Include/SettingsUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ class LTSettingsUI : public LTImgWindow
/// Main function to render the window's interface
void buildInterface() override;

/*
/// Set CSL label configuration
void LabelBtnSave();
// Save CSL path / Load a CSL package
void SaveCSLPath(int idx);*/

public:
/// @brief Creates/opens/displays/hides/closes the settings window
/// @param _force 0 - toggle, <0 force close, >0 force open
Expand Down
6 changes: 6 additions & 0 deletions LiveTraffic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
25ABF65A226E2F77008365AF /* XPLM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A095F52203B0C500658AA8 /* XPLM.framework */; };
25AE00D9213887AF00908E65 /* SettingsUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25AE00D8213887AF00908E65 /* SettingsUI.cpp */; };
25BFBB9320DEE2DC00D52B6C /* LTChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25BFBB9220DEE2DC00D52B6C /* LTChannel.cpp */; };
25C5254424D0268700C73482 /* InfoListWnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25C5254324D0268700C73482 /* InfoListWnd.cpp */; };
25C59458207A296500E52073 /* TextIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25C59456207A296500E52073 /* TextIO.cpp */; };
25C5945A207A2B7600E52073 /* DataRefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25C59459207A2B7500E52073 /* DataRefs.cpp */; };
25C59462207AB4D800E52073 /* LTAircraft.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 25C59461207AB4D800E52073 /* LTAircraft.cpp */; };
Expand Down Expand Up @@ -199,6 +200,8 @@
25BBD2F921EA0F8300AEAA4B /* OpenSky_Routes.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = OpenSky_Routes.json; sourceTree = "<group>"; };
25BBD2FA21EA0FB400AEAA4B /* OpenSky_Metadata_Routes_combined.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = OpenSky_Metadata_Routes_combined.json; sourceTree = "<group>"; };
25BFBB9220DEE2DC00D52B6C /* LTChannel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LTChannel.cpp; sourceTree = "<group>"; };
25C5254224D0264700C73482 /* InfoListWnd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoListWnd.h; sourceTree = "<group>"; };
25C5254324D0268700C73482 /* InfoListWnd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoListWnd.cpp; sourceTree = "<group>"; };
25C59456207A296500E52073 /* TextIO.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TextIO.cpp; sourceTree = "<group>"; };
25C59459207A2B7500E52073 /* DataRefs.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DataRefs.cpp; sourceTree = "<group>"; };
25C59461207AB4D800E52073 /* LTAircraft.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LTAircraft.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -318,6 +321,7 @@
257A10982190E0A8007C1E04 /* ACInfoWnd.cpp */,
2558579320950C6700816F65 /* CoordCalc.cpp */,
25C59459207A2B7500E52073 /* DataRefs.cpp */,
25C5254324D0268700C73482 /* InfoListWnd.cpp */,
D67297EA0F9E0FCC00CFD1FA /* LiveTraffic.cpp */,
2573631E22233CDA005210C5 /* LTADSBEx.cpp */,
25C59461207AB4D800E52073 /* LTAircraft.cpp */,
Expand Down Expand Up @@ -457,6 +461,7 @@
25A095C52203B01300658AA8 /* Constants.h */,
25A095C02203B01300658AA8 /* CoordCalc.h */,
25A095C72203B01300658AA8 /* DataRefs.h */,
25C5254224D0264700C73482 /* InfoListWnd.h */,
25A095C82203B01300658AA8 /* LiveTraffic.h */,
2573631D22233CCA005210C5 /* LTADSBEx.h */,
25A095C92203B01300658AA8 /* LTAircraft.h */,
Expand Down Expand Up @@ -796,6 +801,7 @@
2515F41D248CF4CB00F18B76 /* imgui_stdlib.cpp in Sources */,
257A10992190E0A8007C1E04 /* ACInfoWnd.cpp in Sources */,
25FEB7B9224D7B10002A051F /* LTForeFlight.cpp in Sources */,
25C5254424D0268700C73482 /* InfoListWnd.cpp in Sources */,
25624BDA23B014F600B899E1 /* LTApt.cpp in Sources */,
256CA1CE248C5094009F4AAE /* ImgWindow.cpp in Sources */,
254EA4702083E403008A312F /* parson.c in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,38 @@
uuid = "C8095CDD-1C39-4D01-99B0-6AD4723390BD"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E501A1D1-447F-46E6-9D74-FC0E0DE2FF5D"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Src/InfoListWnd.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "111"
endingLineNumber = "111"
landmarkName = "InfoListWnd::buildInterface()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "8B40973A-4291-4D01-A5E4-374EE08EE3F0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Src/InfoListWnd.cpp"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "101"
endingLineNumber = "101"
landmarkName = "InfoListWnd::buildInterface()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
4 changes: 4 additions & 0 deletions Src/DataRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ DataRefs::dataRefDefinitionT DATA_REFS_LT[CNT_DATAREFS_LT] = {
{"livetraffic/ui/aci/height", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/ui/aci/collapsed", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/ui/aci/font_scale", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/ui/ilw/width", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/ui/ilw/height", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },

// configuration options
{"livetraffic/cfg/aircrafts_displayed", DataRefs::LTGetInt, DataRefs::LTSetAircraftDisplayed, GET_VAR, false },
Expand Down Expand Up @@ -455,6 +457,8 @@ void* DataRefs::getVarAddr (dataRefsLT dr)
case DR_UI_ACI_HEIGHT: return &ACIheight;
case DR_UI_ACI_COLLAPSED: return &ACIcollapsed;
case DR_UI_ACI_FONT_SCALE: return &ACIfontScale;
case DR_UI_ILW_WIDTH: return &ILWwidth;
case DR_UI_ILW_HEIGHT: return &ILWheight;

// configuration options
case DR_CFG_AIRCRAFT_DISPLAYED: return &bShowingAircraft;
Expand Down
Loading

1 comment on commit 4099e75

@TwinFan
Copy link
Owner Author

@TwinFan TwinFan commented on 4099e75 Aug 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beginning for #21, #121

Please sign in to comment.