@@ -66,6 +66,7 @@ public partial class DynamoView : Window, IDisposable
6666 {
6767 public const string BackgroundPreviewName = "BackgroundPreview" ;
6868 private const int SideBarCollapseThreshold = 20 ;
69+ private const int RightSideBarCollapseThreshold = 30 ;
6970 private const int navigationInterval = 100 ;
7071 private const string GraphMetadataExtensionId = "28992e1d-abb9-417f-8b1b-05e053bee670" ;
7172 // This is used to determine whether ESC key is being held down
@@ -111,7 +112,8 @@ public partial class DynamoView : Window, IDisposable
111112
112113 internal ShortcutToolbar ShortcutBar { get { return shortcutBar ; } }
113114
114- internal PreferencesView PreferencesWindow {
115+ internal PreferencesView PreferencesWindow
116+ {
115117 get { return preferencesWindow ; }
116118 }
117119
@@ -151,7 +153,7 @@ public DynamoView(DynamoViewModel dynamoViewModel)
151153 _timer = new Stopwatch ( ) ;
152154 _timer . Start ( ) ;
153155
154- InitializeComponent ( ) ;
156+ InitializeComponent ( ) ;
155157
156158 Loaded += DynamoView_Loaded ;
157159 Unloaded += DynamoView_Unloaded ;
@@ -174,7 +176,7 @@ public DynamoView(DynamoViewModel dynamoViewModel)
174176 {
175177 leftLimit += screen . Bounds . Width ;
176178 topLimit += screen . Bounds . Height ;
177- }
179+ }
178180
179181 Left = dynamoViewModel . Model . PreferenceSettings . WindowX ;
180182 Top = dynamoViewModel . Model . PreferenceSettings . WindowY ;
@@ -374,12 +376,12 @@ private void AddPythonEngineToMainMenu()
374376 }
375377
376378 private void OnWorkspaceHidden ( WorkspaceModel workspace )
377- {
379+ {
378380 CalculateWindowMinWidth ( ) ;
379381 }
380382
381383 private void OnWorkspaceAdded ( WorkspaceModel workspace )
382- {
384+ {
383385 CalculateWindowMinWidth ( ) ;
384386 }
385387
@@ -388,7 +390,7 @@ private void OnRequestExportWorkSpaceAsImage(object parameter)
388390 var workspace = this . ChildOfType < WorkspaceView > ( ) ;
389391 WorkspaceView . ExportImageResult isCurrentWorkSpaceValidForImage = workspace . IsWorkSpaceRenderValidAsImage ( true ) ;
390392
391- if ( isCurrentWorkSpaceValidForImage == WorkspaceView . ExportImageResult . IsValidAsImage )
393+ if ( isCurrentWorkSpaceValidForImage == WorkspaceView . ExportImageResult . IsValidAsImage )
392394 {
393395 dynamoViewModel . ShowSaveImageDialogAndSave ( parameter ) ;
394396 }
@@ -421,7 +423,7 @@ private void DynamoViewModel_RequestEnableShortcutBarItems(bool enable)
421423 {
422424 exportMenu . IsEnabled = enable ;
423425 }
424-
426+
425427 if ( ! ( shortcutBar is null ) )
426428 {
427429 shortcutBar . IsNewButtonEnabled = enable ;
@@ -465,12 +467,12 @@ private void OnWorkspaceOpened(WorkspaceModel workspace)
465467 }
466468
467469 if ( ! ( workspace is HomeWorkspaceModel hws ) )
468- return ;
469-
470+ return ;
471+
470472 foreach ( var extension in viewExtensionManager . StorageAccessViewExtensions )
471473 {
472474 DynamoModel . RaiseIExtensionStorageAccessWorkspaceOpened ( hws , extension , dynamoViewModel . Model . Logger ) ;
473- }
475+ }
474476 }
475477
476478 private void OnWorkspaceSaving ( WorkspaceModel workspace , Graph . SaveContext saveContext )
@@ -594,7 +596,7 @@ private ExtensionWindow AddExtensionWindow(IViewExtension viewExtension, UIEleme
594596 window . ShouldMaximize = true ;
595597 }
596598 }
597-
599+
598600 // Setting the content of the undocked window
599601 // Icon is passed from DynamoView (respecting Host integrator icon)
600602 SetApplicationIcon ( ) ;
@@ -748,7 +750,7 @@ internal void CloseExtensionControl(IViewExtension viewExtension)
748750 CloseRightSideBarTab ( tabitem ) ;
749751 CloseExtensionWindow ( tabName ) ;
750752 }
751-
753+
752754 /// <summary>
753755 /// Event handler for the CloseButton.
754756 /// This method triggers the close operation on the selected tab.
@@ -923,7 +925,8 @@ internal void UndockWindow(TabItem tabItem)
923925 {
924926 pythonNode . OnNodeEdited ( textEditor . Text ) ;
925927 }
926- else {
928+ else
929+ {
927930 pythonNode . OnNodeEdited ( null ) ;
928931 }
929932
@@ -1028,7 +1031,7 @@ private void OnRequestPaste()
10281031
10291032 var locatableModels = clipBoard . Where ( item => item is NoteModel || item is NodeModel ) ;
10301033 var modelsExcludingConnectorPins = locatableModels . Where ( model => ! ( model is ConnectorPinModel ) ) ;
1031- if ( modelsExcludingConnectorPins is null || modelsExcludingConnectorPins . Count ( ) < 1 ) { return ; }
1034+ if ( modelsExcludingConnectorPins is null || modelsExcludingConnectorPins . Count ( ) < 1 ) { return ; }
10321035
10331036 var modelBounds = modelsExcludingConnectorPins . Select ( lm =>
10341037 new Rect { X = lm . X , Y = lm . Y , Height = lm . Height , Width = lm . Width } ) ;
@@ -1202,7 +1205,7 @@ private void DynamoView_SizeChanged(object sender, SizeChangedEventArgs e)
12021205 }
12031206
12041207 UpdateGeometryScalingPopupLocation ( ) ;
1205-
1208+
12061209 CalculateWindowThreshold ( ) ;
12071210 }
12081211
@@ -1220,8 +1223,8 @@ internal double GetSumOfControlsWidth()
12201223 /// <summary>
12211224 /// Calculates the Window threshold to display the text or only icons in the shortcut toolbar
12221225 internal void CalculateWindowThreshold ( )
1223- {
1224- dynamoViewModel . OnWindowResized ( dynamoViewModel . Model . PreferenceSettings . WindowW <= GetSumOfControlsWidth ( ) ) ;
1226+ {
1227+ dynamoViewModel . OnWindowResized ( dynamoViewModel . Model . PreferenceSettings . WindowW <= GetSumOfControlsWidth ( ) ) ;
12251228 }
12261229
12271230 /// <summary>
@@ -1247,7 +1250,7 @@ private void UpdateGeometryScalingPopupLocation()
12471250 if ( workspaceView != null && workspaceView . GeoScalingPopup != null )
12481251 {
12491252 workspaceView . GeoScalingPopup . UpdatePopupLocation ( ) ;
1250- }
1253+ }
12511254 }
12521255
12531256 private void InitializeShortcutBar ( )
@@ -1314,7 +1317,7 @@ private void InitializeShortcutBar()
13141317 shortcutBar . ShortcutBarItems . Add ( saveButton ) ;
13151318 shortcutBar . ShortcutBarItems . Add ( undoButton ) ;
13161319 shortcutBar . ShortcutBarItems . Add ( redoButton ) ;
1317-
1320+
13181321 shortcutBarGrid . Children . Add ( shortcutBar ) ;
13191322 }
13201323
@@ -1427,7 +1430,7 @@ private void DynamoView_Loaded(object sender, EventArgs e)
14271430
14281431 // If first run, Collect Info Prompt will appear
14291432 UsageReportingManager . Instance . CheckIsFirstRun ( this , dynamoViewModel . BrandingResourceProvider ) ;
1430-
1433+
14311434
14321435 WorkspaceTabs . SelectedIndex = 0 ;
14331436 dynamoViewModel = ( DataContext as DynamoViewModel ) ;
@@ -1576,7 +1579,7 @@ private void onRequestShorcutToolbarLoaded(double rightMenuActualWidth)
15761579
15771580 private void GuideFlowEvents_GuidedTourStart ( GuidedTourStateEventArgs args )
15781581 {
1579- if ( sidebarGrid . Visibility != Visibility . Visible || sidebarGrid . ActualWidth < 2 )
1582+ if ( sidebarGrid . Visibility != Visibility . Visible || sidebarGrid . ActualWidth < 2 )
15801583 {
15811584 OnCollapsedLeftSidebarClick ( null , null ) ;
15821585 }
@@ -1875,7 +1878,7 @@ private void DynamoViewModelRequestSave3DImage(object sender, ImageSaveEventArgs
18751878 dpiX = 96 ;
18761879 dpiY = 96 ;
18771880 }
1878-
1881+
18791882 var bitmapSource = BackgroundPreview . View . RenderBitmap ( ) ;
18801883 // this image only really needs 24bits per pixel but to match previous implementation we'll use 32bit images.
18811884 var rtBitmap = new RenderTargetBitmap ( bitmapSource . PixelWidth , bitmapSource . PixelHeight , dpiX , dpiY , PixelFormats . Pbgra32 ) ;
@@ -2181,7 +2184,7 @@ private void WindowClosed(object sender, EventArgs e)
21812184
21822185 // Force application shutdown when dynamo (in standalone mode) is closed, to prevent process hanging
21832186 bool isStandaloneMode = string . IsNullOrEmpty ( DynamoModel . HostAnalyticsInfo . HostName ) ;
2184-
2187+
21852188 if ( ! DynamoModel . IsTestMode && isStandaloneMode && Application . Current != null )
21862189 {
21872190 try
@@ -2222,7 +2225,7 @@ private void WindowClosed(object sender, EventArgs e)
22222225
22232226 dynamoViewModel . RequestPythonEngineChangeNotice -= DynamoViewModel_RequestPythonEngineChangeNotice ;
22242227 dynamoViewModel . PythonEngineUpgradeToastRequested -= OnPythonEngineUpgradeToastRequested ;
2225-
2228+
22262229 if ( graphPropsExtensionMenuItem != null )
22272230 {
22282231 graphPropsExtensionMenuItem . Checked -= OnGraphMetadataChecked ;
@@ -2258,10 +2261,10 @@ private void WindowClosed(object sender, EventArgs e)
22582261 }
22592262 catch ( Exception exc )
22602263 {
2261- Log ( $ "{ ext . Name } : { exc . Message } during shutdown" ) ;
2264+ Log ( $ "{ ext . Name } : { exc . Message } during shutdown") ;
22622265 }
22632266 }
2264-
2267+
22652268
22662269 viewExtensionManager . MessageLogged -= Log ;
22672270 BackgroundPreview = null ;
@@ -2869,6 +2872,8 @@ private void OnlineStatusGrid_MouseEnter(object sender, MouseEventArgs e)
28692872
28702873 // Default side bar width
28712874 private const int defaultSideBarWidth = 200 ;
2875+ //By default the extension bar width in px;
2876+ private const int defaultRightSideBarWidth = 455 ;
28722877 // By default the extension bar over canvas size ratio is 2/5
28732878 private const int DefaultExtensionBarWidthMultiplier = 2 ;
28742879
@@ -2906,7 +2911,7 @@ public bool ExtensionsCollapsed
29062911 }
29072912 else
29082913 {
2909- extensionsCollapsed = RightExtensionsViewColumn . Width . Value < SideBarCollapseThreshold ;
2914+ extensionsCollapsed = RightExtensionsViewColumn . Width . Value < RightSideBarCollapseThreshold ;
29102915 }
29112916
29122917 return extensionsCollapsed ;
@@ -2944,7 +2949,8 @@ private void HideOrShowRightSideBar()
29442949 {
29452950 if ( dynamoViewModel . SideBarTabItems . Count == 0 )
29462951 {
2947- if ( RightExtensionsViewColumn . Width . Value != 0 )
2952+ if ( RightExtensionsViewColumn . Width . Value != 0
2953+ && RightExtensionsViewColumn . ActualWidth > RightSideBarCollapseThreshold )
29482954 {
29492955 extensionsColumnWidth = RightExtensionsViewColumn . Width ;
29502956 }
@@ -2957,7 +2963,7 @@ private void HideOrShowRightSideBar()
29572963 // 1. It allows the resized width to be remembered which is nice to have.
29582964 // 2. It allows to avoid a slider glitch which sets the panels size in pixel amount but using star,
29592965 // changing the proportions so that the initial value is counted as pixels after the first resize.
2960- if ( extensionsColumnWidth == null )
2966+ if ( extensionsColumnWidth == null || extensionsColumnWidth . Value . Value < RightSideBarCollapseThreshold )
29612967 {
29622968 RightExtensionsViewColumn . Width = new GridLength ( DefaultExtensionBarWidthMultiplier , GridUnitType . Star ) ;
29632969 }
@@ -2997,23 +3003,20 @@ internal void ToggleExtensionBarCollapseStatus()
29973003 if ( ExtensionsCollapsed )
29983004 {
29993005 if ( extensionsColumnWidth == null )
3000- {
30013006 RightExtensionsViewColumn . Width = new GridLength ( DefaultExtensionBarWidthMultiplier , GridUnitType . Star ) ;
3007+ else if ( extensionsColumnWidth . Value . Value <= RightSideBarCollapseThreshold &&
3008+ ! extensionsColumnWidth . Value . Equals ( new GridLength ( DefaultExtensionBarWidthMultiplier , GridUnitType . Star ) ) )
3009+ {
3010+ RightExtensionsViewColumn . Width = new GridLength ( defaultRightSideBarWidth , GridUnitType . Star ) ;
30023011 }
30033012 else
3004- {
30053013 RightExtensionsViewColumn . Width = extensionsColumnWidth . Value ;
3006- }
30073014 }
30083015 else
30093016 {
3010- if ( RightExtensionsViewColumn . Width . Value != 0 )
3011- {
3012- extensionsColumnWidth = RightExtensionsViewColumn . Width ;
3013- }
3017+ extensionsColumnWidth = RightExtensionsViewColumn . Width ;
30143018 RightExtensionsViewColumn . Width = new GridLength ( 0 , GridUnitType . Star ) ;
30153019 }
3016-
30173020 // TODO: Maynot need this depending on tab design
30183021 UpdateLibraryCollapseIcon ( ) ;
30193022 }
@@ -3122,7 +3125,7 @@ private void Window_PreviewMouseUp(object sender, MouseButtonEventArgs e)
31223125 private void WorkspaceTabs_TargetUpdated ( object sender , DataTransferEventArgs e )
31233126 {
31243127 if ( WorkspaceTabs . SelectedIndex >= 0 )
3125- ToggleWorkspaceTabVisibility ( WorkspaceTabs . SelectedIndex ) ;
3128+ ToggleWorkspaceTabVisibility ( WorkspaceTabs . SelectedIndex ) ;
31263129 UpdateWorkspaceTabSizes ( ) ;
31273130 }
31283131
@@ -3148,10 +3151,10 @@ private void WorkspaceTabs_SizeChanged(object sender, SizeChangedEventArgs e)
31483151 /// </summary>
31493152 private void UpdateWorkspaceTabSizes ( )
31503153 {
3151-
3154+
31523155 // We measure the full library width at runtime.
31533156 int fullLibraryWidth = dynamoViewModel . LibraryWidth + LibraryScrollBarWidth ;
3154-
3157+
31553158 // Difference between the full library width (at runtime) and the minimum offset required
31563159 // by the TabItems to not overlap the 5 icon buttons.
31573160 int difference = fullLibraryWidth - FirstTabItemMinimumLeftMarginOffset ;
@@ -3211,13 +3214,13 @@ private void Log(string message)
32113214 }
32123215 private void LogNotification ( NotificationMessage notification )
32133216 {
3214- dynamoViewModel . Model . Logger . LogNotification ( notification . Sender , notification . Title , notification . ShortMessage , notification . DetailedMessage ) ;
3217+ dynamoViewModel . Model . Logger . LogNotification ( notification . Sender , notification . Title , notification . ShortMessage , notification . DetailedMessage ) ;
32153218 }
32163219
32173220 private void Window_PreviewMouseLeftButtonUp ( object sender , MouseButtonEventArgs e )
32183221 {
32193222 //if original sender was scroll bar(i.e Thumb) don't close the popup.
3220- if ( ! ( e . OriginalSource is Thumb ) && ! ( e . OriginalSource is TextBox ) )
3223+ if ( ! ( e . OriginalSource is Thumb ) && ! ( e . OriginalSource is TextBox ) )
32213224 {
32223225 HidePopupWhenWindowDeactivated ( sender ) ;
32233226 }
@@ -3245,7 +3248,7 @@ private void ShowGetStartedGuidedTour()
32453248 {
32463249 //We pass the root UIElement to the GuidesManager so we can found other child UIElements
32473250 try
3248- {
3251+ {
32493252 dynamoViewModel . MainGuideManager . LaunchTour ( GuidesManager . GetStartedGuideName ) ;
32503253 }
32513254 catch ( Exception )
@@ -3256,15 +3259,16 @@ private void ShowGetStartedGuidedTour()
32563259
32573260 private void RightExtensionSidebar_DragCompleted ( object sender , DragCompletedEventArgs e )
32583261 {
3259- //Setting the width of right extension after resize to
3262+ //Setting the width of right extension after resize to only if extension bar widht is greater than threshold value.
3263+ if ( RightExtensionsViewColumn . ActualWidth > defaultRightSideBarWidth )
32603264 extensionsColumnWidth = RightExtensionsViewColumn . Width ;
32613265 }
32623266
32633267 private void PackagesMenuGuide_Click ( object sender , RoutedEventArgs e )
32643268 {
32653269 try
32663270 {
3267- dynamoViewModel . MainGuideManager . LaunchTour ( GuidesManager . PackagesGuideName ) ;
3271+ dynamoViewModel . MainGuideManager . LaunchTour ( GuidesManager . PackagesGuideName ) ;
32683272 }
32693273 catch ( Exception )
32703274 {
@@ -3280,7 +3284,7 @@ private void FileTrustWarning_Click(object sender, RoutedEventArgs e)
32803284 }
32813285
32823286 private void DynamoView_Activated ( object sender , EventArgs e )
3283- {
3287+ {
32843288 if ( fileTrustWarningPopup != null && dynamoViewModel . ViewingHomespace )
32853289 {
32863290 fileTrustWarningPopup . ManagePopupActivation ( true ) ;
@@ -3289,7 +3293,7 @@ private void DynamoView_Activated(object sender, EventArgs e)
32893293
32903294 private void DynamoView_Deactivated ( object sender , EventArgs e )
32913295 {
3292- if ( fileTrustWarningPopup != null )
3296+ if ( fileTrustWarningPopup != null )
32933297 fileTrustWarningPopup . ManagePopupActivation ( false ) ;
32943298 }
32953299
0 commit comments