View Issue Details

IDProjectCategoryView StatusLast Update
0001406PluginsEMenupublic2010-07-07 05:44
Reporterigor_yudincev Assigned Toalexy  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformx86OSWindowsOS VersionXP SP2
Product Version2.0 
Fixed in Version2.0 
Summary0001406: Плагин не работает с большим буфером консоли
DescriptionПри расчёте координат меню не учитываются размеры видимого окна консоли.
Additional InformationПатч прилагается.
TagsNo tags attached.

Activities

igor_yudincev

2010-06-12 16:04

reporter  

build35.patch (2,279 bytes)   
Index: EMenu.rc
===================================================================
--- EMenu.rc	(revision 4771)
+++ EMenu.rc	(working copy)
@@ -2,7 +2,7 @@
 #include <windows.h>
 #include "resource.h"
 
-#define PLUGIN_BUILD 34
+#define PLUGIN_BUILD 35
 #define PLUGIN_DESC "EMenu Plugin for FAR Manager"
 #define PLUGIN_NAME "EMenu"
 #define PLUGIN_FILENAME "EMenu.dll"
Index: FarMenu.cpp
===================================================================
--- FarMenu.cpp	(revision 4771)
+++ FarMenu.cpp	(working copy)
@@ -184,21 +184,42 @@
     else
     {
       RECT rc;
-      CONSOLE_SCREEN_BUFFER_INFO csbi;
-      HANDLE hStdOutput=GetStdHandle(STD_OUTPUT_HANDLE);
-      if (!GetClientRect(hFarWnd, &rc)
-        || INVALID_HANDLE_VALUE==hStdOutput
-        || !GetConsoleScreenBufferInfo(hStdOutput, &csbi))
-      {
+      if (!GetClientRect(hFarWnd, &rc))
         assert(0);
-      }
-      else
-      {
-        if (pt.x>=rc.left && pt.x<=rc.right && pt.y>=rc.top && pt.y<=rc.bottom)
+      else {
+        bool success=false;
+        COORD console_size;
+#ifndef UNICODE
+        CONSOLE_SCREEN_BUFFER_INFO csbi;
+        HANDLE hStdOutput=GetStdHandle(STD_OUTPUT_HANDLE);
+        if (INVALID_HANDLE_VALUE!=hStdOutput
+          && GetConsoleScreenBufferInfo(hStdOutput, &csbi))
         {
-          *pnX=int(csbi.dwSize.X*pt.x/(rc.right-rc.left));
-          *pnY=int(csbi.dwSize.Y*pt.y/(rc.bottom-rc.top));
+          success=true;
+          console_size.X=csbi.dwSize.X;
+          console_size.Y=csbi.dwSize.Y;
         }
+#else
+        SMALL_RECT console_rect;
+        if (thePlug->AdvControl(ACTL_GETFARRECT,(void*)&console_rect))
+        {
+          success=true;
+          console_size.X=console_rect.Right-console_rect.Left+1;
+          console_size.Y=console_rect.Bottom-console_rect.Top+1;
+        }
+#endif
+        if (!success)
+        {
+          assert(0);
+        }
+        else
+        {
+          if (pt.x>=rc.left && pt.x<=rc.right && pt.y>=rc.top && pt.y<=rc.bottom)
+          {
+            *pnX=int(console_size.X*pt.x/(rc.right-rc.left));
+            *pnY=int(console_size.Y*pt.y/(rc.bottom-rc.top));
+          }
+        }
       }
     }
   }
build35.patch (2,279 bytes)   

JohnDoe

2010-06-12 17:35

updater   bugnote:0005478

>При расчёте координат меню не учитываются размеры видимого окна консоли
А как увидеть проблему?

igor_yudincev

2010-06-12 18:00

reporter   bugnote:0005480

> А как увидеть проблему?
Настроить Menu position (•) At the mouse cursor, включить большой буфер консоли и вызвать диалог плагина.

alexy

2010-07-03 17:13

administrator   bugnote:0005551

закомитил

Issue History

Date Modified Username Field Change
2010-06-12 16:04 igor_yudincev New Issue
2010-06-12 16:04 igor_yudincev File Added: build35.patch
2010-06-12 17:35 JohnDoe Note Added: 0005478
2010-06-12 18:00 igor_yudincev Note Added: 0005480
2010-07-03 17:13 alexy Note Added: 0005551
2010-07-03 17:13 alexy Assigned To => alexy
2010-07-03 17:13 alexy Status new => feedback
2010-07-06 21:29 igor_yudincev Status feedback => resolved
2010-07-07 05:44 alexy Status resolved => closed
2010-07-07 05:44 alexy Resolution open => fixed
2010-07-07 05:44 alexy Fixed in Version => 2.0