Skip to content

Commit

Permalink
upgrade to latest JX
Browse files Browse the repository at this point in the history
  • Loading branch information
jafl committed May 14, 2024
1 parent 7a600b9 commit 187f60a
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 69 deletions.
7 changes: 2 additions & 5 deletions code/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Application::Application
// warn that prefs are unreadable.

itsWindowList = jnew JPtrArray<TreeDir>(JPtrArrayT::kForgetAll);
assert( itsWindowList != nullptr );

*displayAbout = CreateGlobals(this);

Expand All @@ -110,12 +109,10 @@ Application::Application
JGetUserMountPointList(itsMountPointList, &itsMountPointState);

itsShortcutList = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll);
assert( itsShortcutList != nullptr );
itsShortcutList->SetCompareFunction(CompareShortcuts);
itsShortcutList->SetSortOrder(JListT::kSortAscending);

itsMountPointPrefs = jnew JStringPtrMap<JString>(JPtrArrayT::kDeleteAll);
assert( itsMountPointPrefs != nullptr );

SetPrefInfo(GetPrefsMgr(), kSAppID);
JPrefObject::ReadPrefs();
Expand Down Expand Up @@ -558,7 +555,6 @@ Application::AddShortcut
)
{
auto* s = jnew JString(JConvertToHomeDirShortcut(shortcut));
assert( s != nullptr );
if (!itsShortcutList->InsertSorted(s, false))
{
jdelete s;
Expand Down Expand Up @@ -871,7 +867,8 @@ Application::DisplayAbout
ForgetPrefsMgr();
JXGetApplication()->Quit();
}
});
},
"Application::DisplayAbout");
}

/******************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions code/FileTreeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ FileTreeList::GetFileNode
)
{
auto* node = dynamic_cast<FileTreeNode*>(GetNode(index));
assert (node != nullptr);
assert( node != nullptr );
return node;
}

Expand All @@ -83,7 +83,7 @@ FileTreeList::GetFileNode
const
{
const auto* node = dynamic_cast<const FileTreeNode*>(GetNode(index));
assert (node != nullptr);
assert( node != nullptr );
return node;
}

Expand Down
8 changes: 4 additions & 4 deletions code/FileTreeNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ FileTree*
FileTreeNode::GetFileTree()
{
auto* tree = dynamic_cast<FileTree*>(GetTree());
assert (tree != nullptr);
assert( tree != nullptr );
return tree;
}

Expand All @@ -101,7 +101,7 @@ FileTreeNode::GetFileTree()
const
{
const auto* tree = dynamic_cast<const FileTree*>(GetTree());
assert (tree != nullptr);
assert( tree != nullptr );
return tree;
}

Expand Down Expand Up @@ -182,7 +182,7 @@ FileTreeNode::GetFileChild
)
{
auto* node = dynamic_cast<FileTreeNode*>(GetChild(index));
assert (node != nullptr);
assert( node != nullptr );
return node;
}

Expand All @@ -194,6 +194,6 @@ FileTreeNode::GetFileChild
const
{
const auto* node = dynamic_cast<const FileTreeNode*>(GetChild(index));
assert (node != nullptr);
assert( node != nullptr );
return node;
}
17 changes: 7 additions & 10 deletions code/FileTreeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ FileTreeTable::FileTreeTable
}));

itsShortcutsMenu = menuBar->AppendTextMenu(JGetString("MenuTitle::FileTreeTable_Shortcuts"));
assert (itsShortcutsMenu != nullptr);
itsShortcutsMenu->SetMenuItems(kShortcutsMenuStr);
itsShortcutsMenu->SetUpdateAction(JXMenu::kDisableNone);
itsShortcutsMenu->AttachHandlers(this,
Expand All @@ -356,7 +355,9 @@ FileTreeTable::FileTreeTable

// updating

itsUpdateTask = jnew JXFunctionTask(kDirUpdateInterval, std::bind(&FileTreeTable::UpdateDisplay, this, false));
itsUpdateTask = jnew JXFunctionTask(kDirUpdateInterval,
std::bind(&FileTreeTable::UpdateDisplay, this, false),
"FileTreeTable::UpdateDisplay");

JXWindow* window = GetWindow();
// if (!window->IsIconified()) // update window icon while iconified
Expand Down Expand Up @@ -1869,8 +1870,7 @@ FileTreeTable::Receive
{
if (sender == itsRecentFilesMenu && message.Is(JXFSDirMenu::kFileSelected))
{
const auto* info =
dynamic_cast<const JXFSDirMenu::FileSelected*>(&message);
auto* info = dynamic_cast<const JXFSDirMenu::FileSelected*>(&message);
assert( info != nullptr );

const JDirEntry entry(info->GetFileName());
Expand All @@ -1895,8 +1895,7 @@ FileTreeTable::Receive

else if (sender == itsGitProcess && message.Is(JProcess::kFinished))
{
const auto* info =
dynamic_cast<const JProcess::Finished*>(&message);
auto* info = dynamic_cast<const JProcess::Finished*>(&message);
assert(info != nullptr);
if (info->Successful())
{
Expand All @@ -1915,8 +1914,7 @@ FileTreeTable::Receive
}
else if (sender == itsIconWidget && message.Is(JXWindowIcon::kHandleDrop))
{
const auto* info =
dynamic_cast<const JXWindowIcon::HandleDrop*>(&message);
auto* info = dynamic_cast<const JXWindowIcon::HandleDrop*>(&message);
assert( info != nullptr );
HandleDNDDrop(JPoint(0,0), info->GetTypeList(), info->GetAction(),
info->GetTime(), info->GetSource());
Expand Down Expand Up @@ -1986,8 +1984,7 @@ FileTreeTable::ReceiveWithFeedback
{
if (sender == itsIconWidget && message->Is(JXWindowIcon::kAcceptDrop))
{
auto* info =
dynamic_cast<JXWindowIcon::AcceptDrop*>(message);
auto* info = dynamic_cast<JXWindowIcon::AcceptDrop*>(message);
assert( info != nullptr );
info->ShouldAcceptDrop(WillAcceptDrop(
info->GetTypeList(), info->GetActionPtr(),
Expand Down
9 changes: 3 additions & 6 deletions code/FindFileTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
bool
FindFileTask::Create
(
TreeDir* dir,
const JString& path,
const JString& expr,
TreeDir* dir,
const JString& path,
const JString& expr,
FindFileTask** task
)
{
Expand All @@ -50,7 +50,6 @@ FindFileTask::Create
iter.Invalidate();

*task = jnew FindFileTask(dir, relPath, p, outFD, errFD);
assert( *task != nullptr );
return true;
}
else
Expand Down Expand Up @@ -92,8 +91,6 @@ FindFileTask::FindFileTask
ListenTo(itsDirector);

itsPathList = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll);
assert( itsPathList != nullptr );

SplitPath(relPath, itsPathList);

itsDirector->GetTable()->GetFileTree()->Update(true);
Expand Down
3 changes: 0 additions & 3 deletions code/FolderDragSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ FolderDragSource::FolderDragSource
SetHint(JGetString("Hint::FolderDragSource"));

itsPathMenu = jnew JXCurrentPathMenu(JGetRootDirectory(), this, kFixedLeft, kFixedTop, 0,0, 10,10);
assert( itsPathMenu != nullptr );
itsPathMenu->Hide();
itsPathMenu->SetToHiddenPopupMenu(true);
*pathMenu = itsPathMenu;
Expand Down Expand Up @@ -114,8 +113,6 @@ FolderDragSource::HandleMouseDrag
list.Append(&const_cast<JString&>(path));

auto* data = jnew JXFileSelection(GetDisplay(), list);
assert( data != nullptr );

BeginDND(pt, buttonStates, modifiers, data);
}
}
Expand Down
2 changes: 0 additions & 2 deletions code/PrefsMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ PrefsMgr::EditPrefs()
auto* dlog = jnew EditPrefsDialog(termCmd, manCmd, gitStatusCmd, gitHistoryCmd,
coCmd, DelWillDelete(), WillOpenNewWindows(),
WillSaveFolderPrefs());
assert( dlog != nullptr );

if (dlog->DoDialog())
{
JString manCmd, termCmd, gitStatusCmd, gitHistoryCmd, postCheckoutCmd;
Expand Down
1 change: 0 additions & 1 deletion code/TrashButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ TrashButton::MoveFilesToTrash
if (returnType == selManager->GetURLXAtom())
{
auto* fileNameList = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll);
assert( fileNameList != nullptr );
JPtrArray<JString> urlList(JPtrArrayT::kDeleteAll);
JXUnpackFileNames((char*) data, dataLength, fileNameList, &urlList);

Expand Down
3 changes: 0 additions & 3 deletions code/TreeDir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ TreeDir::BuildWindow
{
input = jnew std::ifstream(prefsFile.GetBytes());
}
assert( input != nullptr );

JFileVersion vers = 0;
JSize w, h;
Expand Down Expand Up @@ -286,7 +285,6 @@ TreeDir::BuildWindow
JXWidget::kHElastic, JXWidget::kVElastic,
0,0, 1000,1000);
}
assert( itsTreeSet != nullptr );
// itsTreeSet has already called FitToEnclosure()
ListenTo(GetTable());

Expand All @@ -295,7 +293,6 @@ TreeDir::BuildWindow
auto* windowsMenu =
jnew JXWDMenu(JGetString("WindowsMenuTitle::JXGlobal"), menuBar,
JXWidget::kFixedLeft, JXWidget::kVElastic, 0,0, 10,10);
assert( windowsMenu != nullptr );
menuBar->AppendMenu(windowsMenu);
if (JXMenu::GetDisplayStyle() == JXMenu::kWindowsStyle)
{
Expand Down
16 changes: 5 additions & 11 deletions code/TreeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void TreeSet::TreeSetX
}

auto* entry = jnew JDirEntry(path);
assert( entry != nullptr && JFSFileTreeNode::CanHaveChildren(*entry) );
assert( JFSFileTreeNode::CanHaveChildren(*entry) );
auto* root = jnew FileTreeNode(entry);
itsFileTree = jnew FileTree(root);
auto* treeList = jnew FileTreeList(itsFileTree);
Expand All @@ -167,22 +167,18 @@ void TreeSet::TreeSetX
itsScrollbarSet, encl, kHElastic, kVElastic,
0, headerHeight,
enclApG.width(), enclApG.height()-headerHeight);
assert( itsTable != nullptr );
ListenTo(itsFileTree->GetRootDirInfo());

auto* colHeader =
jnew HeaderWidget(itsTable, itsScrollbarSet, encl,
kHElastic, kFixedTop,
0,0, enclApG.width(),
headerHeight);
assert(colHeader != nullptr);
jnew HeaderWidget(itsTable, itsScrollbarSet, encl,
kHElastic, kFixedTop,
0,0, enclApG.width(),
headerHeight);

// header: filter

itsFilterLabel =
jnew JXStaticText(JGetString("FilterLabel::TreeSet"), this, kFixedLeft, kFixedTop,
5,0, 40, filterHeight);
assert( itsFilterLabel != nullptr );
itsFilterLabel->SetToLabel();

itsFilterHistory =
Expand All @@ -195,7 +191,6 @@ void TreeSet::TreeSetX
itsFilterInput =
jnew FilterInput(itsTable, this, kHElastic, kFixedTop,
45,0, w - 45 - itsFilterHistory->GetFrameWidth(), filterHeight);
assert( itsFilterInput != nullptr );
itsFilterInput->SetFont(font);

// footer: path input, drag source
Expand Down Expand Up @@ -338,7 +333,6 @@ TreeSet::UpdateDisplay
jnew JXTextButton(JGetString("EmptyTrashLabel::TreeSet"), encl, kFixedRight, kFixedTop,
w - kEmptyButtonWidth, 0,
kEmptyButtonWidth, kJXDefaultMenuBarHeight);
assert( itsEmptyButton != nullptr );
ListenTo(itsEmptyButton);
}
else if (!isTrashDir && itsEmptyButton != nullptr)
Expand Down
27 changes: 7 additions & 20 deletions code/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,12 @@ CreateGlobals

JXInitHelp();

auto* wdMgr = jnew JXWDManager(app->GetCurrentDisplay(), true);
assert( wdMgr != nullptr );
jnew JXWDManager(app->GetCurrentDisplay(), true);
// registers itself

theMDIServer = jnew MDIServer;

theManPageDialog = jnew ViewManPageDialog(JXGetPersistentWindowOwner());
assert( theManPageDialog != nullptr );

theMDIServer = jnew MDIServer;
theManPageDialog = jnew ViewManPageDialog(JXGetPersistentWindowOwner());
theFindFileDialog = jnew FindFileDialog(JXGetPersistentWindowOwner());
assert( theFindFileDialog != nullptr );

JString trashDir;
GetTrashDirectory(&trashDir, false); // silently creates it
Expand Down Expand Up @@ -541,17 +536,9 @@ GetDNDAskActions
actionList->AppendItem(dndMgr->GetDNDActionMoveXAtom());
actionList->AppendItem(dndMgr->GetDNDActionLinkXAtom());

auto* s = jnew JString(JGetString("DNDCopyDescription::globals"));
assert( s != nullptr );
descriptionList->Append(s);

s = jnew JString(JGetString("DNDMoveDescription::globals"));
assert( s != nullptr );
descriptionList->Append(s);

s = jnew JString(JGetString("DNDLinkDescription::globals"));
assert( s != nullptr );
descriptionList->Append(s);
descriptionList->Append(JGetString("DNDCopyDescription::globals"));
descriptionList->Append(JGetString("DNDMoveDescription::globals"));
descriptionList->Append(JGetString("DNDLinkDescription::globals"));
}

/******************************************************************************
Expand Down Expand Up @@ -733,7 +720,7 @@ GetDirectorySmallIcon
{
JMountType type;
JXImage* image;
if ((GetApplication())->IsMountPoint(path, &type) &&
if (GetApplication()->IsMountPoint(path, &type) &&
GetMountPointSmallIcon(type, &image))
{
return image;
Expand Down
3 changes: 2 additions & 1 deletion code/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ main
GetMDIServer()->HandleCmdLineOptions(argc, argv);

JXFSBindingManager::Initialize(); // notify user of any upgrades
});
},
"main->mdi");

if (displayAbout)
{
Expand Down
2 changes: 1 addition & 1 deletion systemg.jcc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jx_browser_data 97
jx_browser_data 98
# project tree
0 "root"
T
Expand Down

0 comments on commit 187f60a

Please sign in to comment.