mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 01:56:31 +03:00
Some minor fixes in UICodeEditorSplitter and UIAbstractTableView.
This commit is contained in:
@@ -72,6 +72,7 @@ class EE_API UIAbstractTableView : public UIAbstractView {
|
||||
friend class EE::UI::UITableHeaderColumn;
|
||||
|
||||
struct ColumnData {
|
||||
Float minWidth{0};
|
||||
Float width{0};
|
||||
bool visible{true};
|
||||
UIPushButton* widget{nullptr};
|
||||
|
||||
@@ -91,10 +91,13 @@ void UIAbstractTableView::createOrUpdateColumns() {
|
||||
col.widget->setVisible( col.visible );
|
||||
if ( !col.visible )
|
||||
continue;
|
||||
col.widget->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent );
|
||||
col.widget->setText( model->columnName( i ) );
|
||||
col.widget->reloadStyle( true, true, true );
|
||||
col.width = eeceil( eemax( col.width, col.widget->getPixelsSize().getWidth() ) );
|
||||
if ( col.minWidth == 0 ) {
|
||||
col.widget->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent );
|
||||
col.widget->setText( model->columnName( i ) );
|
||||
col.widget->reloadStyle( true, true, true );
|
||||
col.minWidth = col.widget->getPixelsSize().getWidth();
|
||||
}
|
||||
col.width = eeceil( eemax( col.width, col.minWidth ) );
|
||||
col.widget->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
|
||||
col.widget->setPixelsSize( col.width, getHeaderHeight() );
|
||||
totalWidth += col.width;
|
||||
|
||||
@@ -651,6 +651,9 @@ void UICodeEditorSplitter::onTabClosed( const TabEvent* tabEvent ) {
|
||||
closeSplitter( splitter );
|
||||
eeASSERT( parent->getChildCount() == 0 );
|
||||
remainingNode->setParent( parent );
|
||||
if ( remainingNode->isWidget() )
|
||||
remainingNode->asType<UIWidget>()->setLayoutSizePolicy(
|
||||
SizePolicy::MatchParent, SizePolicy::MatchParent );
|
||||
addRemainingTabWidgets( remainingNode );
|
||||
focusSomeEditor( nullptr );
|
||||
}
|
||||
|
||||
@@ -456,27 +456,33 @@ void App::initLocateBar() {
|
||||
} );
|
||||
}
|
||||
|
||||
void App::showLocateBar() {
|
||||
mLocateBarLayout->setVisible( true );
|
||||
mLocateInput->setFocus();
|
||||
mLocateTable->setVisible( true );
|
||||
if ( mDirTree && !mLocateTable->getModel() ) {
|
||||
mLocateTable->setModel( mDirTree->asModel( LOCATEBAR_MAX_RESULTS ) );
|
||||
mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) );
|
||||
}
|
||||
void App::updateLocateBar() {
|
||||
mLocateBarLayout->runOnMainThread( [&] {
|
||||
Float width = eeceil( mLocateInput->getPixelsSize().getWidth() );
|
||||
mLocateTable->setPixelsSize( width,
|
||||
mLocateTable->getRowHeight() * LOCATEBAR_MAX_VISIBLE_ITEMS );
|
||||
mLocateTable->setColumnWidth( 0, width * 0.5f );
|
||||
mLocateTable->setColumnWidth(
|
||||
1, width * 0.5f - mLocateTable->getVerticalScrollBar()->getPixelsSize().getWidth() );
|
||||
width -= mLocateTable->getVerticalScrollBar()->getPixelsSize().getWidth();
|
||||
mLocateTable->setColumnWidth( 0, eeceil( width * 0.5 ) );
|
||||
mLocateTable->setColumnWidth( 1, width - mLocateTable->getColumnWidth( 0 ) );
|
||||
Vector2f pos( mLocateInput->convertToWorldSpace( {0, 0} ) );
|
||||
pos.y -= mLocateTable->getPixelsSize().getHeight();
|
||||
mLocateTable->setPixelsPosition( pos );
|
||||
} );
|
||||
}
|
||||
|
||||
void App::showLocateBar() {
|
||||
mLocateBarLayout->setVisible( true );
|
||||
mLocateInput->setFocus();
|
||||
mLocateTable->setVisible( true );
|
||||
mLocateInput->addEventListener( Event::OnSizeChange,
|
||||
[&]( const Event* ) { updateLocateBar(); } );
|
||||
if ( mDirTree && !mLocateTable->getModel() ) {
|
||||
mLocateTable->setModel( mDirTree->asModel( LOCATEBAR_MAX_RESULTS ) );
|
||||
mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) );
|
||||
}
|
||||
updateLocateBar();
|
||||
}
|
||||
|
||||
void App::initSearchBar() {
|
||||
auto addClickListener = [&]( UIWidget* widget, std::string cmd ) {
|
||||
widget->addEventListener( Event::MouseClick, [this, cmd]( const Event* event ) {
|
||||
@@ -1453,6 +1459,7 @@ void App::createSettingsMenu() {
|
||||
}
|
||||
} );
|
||||
updateRecentFiles();
|
||||
updateRecentFolders();
|
||||
}
|
||||
|
||||
void App::updateColorSchemeMenu() {
|
||||
@@ -1851,6 +1858,7 @@ void App::init( const std::string& file, const Float& pidelDensity ) {
|
||||
mDocInfo->setVisible( mConfig.editor.showDocInfo );
|
||||
mSearchBarLayout->setVisible( false )->setEnabled( false );
|
||||
mProjectSplitter->setSplitPartition( StyleSheetLength( mConfig.window.panelPartition ) );
|
||||
|
||||
if ( !mConfig.ui.showSidePanel )
|
||||
showSidePanel( mConfig.ui.showSidePanel );
|
||||
|
||||
@@ -1867,6 +1875,10 @@ void App::init( const std::string& file, const Float& pidelDensity ) {
|
||||
|
||||
mEditorSplitter->createEditorWithTabWidget( mBaseLayout );
|
||||
|
||||
std::string locateKeybind( getKeybind( "open-locatebar" ) );
|
||||
if ( !locateKeybind.empty() )
|
||||
mLocateInput->setHint( "Type to locate (" + locateKeybind + ")" );
|
||||
|
||||
mConsole = eeNew( Console, ( fontMono, true, true, 1024 * 1000, 0, mWindow ) );
|
||||
|
||||
initProjectTreeView( file );
|
||||
|
||||
@@ -295,6 +295,8 @@ class App : public UICodeEditorSplitter::Client {
|
||||
void updateDocInfo( TextDocument& doc );
|
||||
|
||||
void setFocusEditorOnClose( UIMessageBox* msgBox );
|
||||
|
||||
void updateLocateBar();
|
||||
};
|
||||
|
||||
#endif // EE_TOOLS_CODEEDITOR_HPP
|
||||
|
||||
Reference in New Issue
Block a user