Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello!

Ah - so Window is misleading, that is a very low base class. You want
to inherit from eg. Dialog, or SystemWindow I suspect.
1. I expect this window hasn't any system borders and menus (close, minimize and so on). I expect this window isn't a dialog and hasn't any menubar (SystemWindow has the menubar). I need draw on this window, set its position and get mouse input from it.

Well; you sure it is white ? I had a hack at this in the past - I
attach my nasty patch to writer to make shockingly ugly looking
gradients in the background ;-) hopefully it shows you where to hack.
Having said that I think some of that code needs cleaning up really :-)
2. I did the gradient background in a same way (in _PaintDesktop() function), like this:

   Color col_start(0xFF, 0x00, 0x00), col_end(0x00, 0x00, 0xFF);
   Size sz = pWin->GetSizePixel(); // we get size of window containing
   a document [in pixels]
   Rectangle rect(0, 0, sz.Widht(), sz.Height());
   rect = GetOut()->PixelToLogic(rect); // convert rect of window to
   logic space
   ...
   float alpha1 = float(aRectangle.Top() - rect.Top()) /
   float(rect.Height());
   float alpha2 = float(aRectangle.Bottom() - rect.Top()) /
   float(rect.Height());
   Color c1 = (1 - alpha1)*col_start + (alpha1) *col_end; // this is
   math formula, but it is not difficult to implement in C++
   Color c2 = (1 - alpha2)*col_start + (alpha2) *col_end; // this is
   math formula, but it is not difficult to implement in C++
   GetOut()->DrawGradient(aRectangle, Gradient(GradientStyle_LINEAR,
   c1, c2));

But this solution has probably two problems. First, during scrolling the borders of page doesn't redraw correctly (this artifact cannot be seen in case of old background with one simple color). Second, the space between pages doesn't redraw during scrolling.
Your variant has the same problem.


26.04.2011 17:09, Michael Meeks пишет:
Hi there !

On Tue, 2011-04-26 at 12:25 +0400, Георгий Сапронов wrote:
Rafael Cabral from Mandriva recommended you as professional in
OpenOffice developing.
        Good man :-) but really the best thing is to CC the public development
list: don't be afraid - we're quite friendly.

        libreoffice@lists.freedesktop.org

        please CC your replies to this there :-) it is much quicker and you get
replies when I'm on holiday / busy etc.

I and Dmitry Ashkadov (in CC) making changes in OpenOffice. But we get
in trouble. We'll be glad if you could help us a little :)
        We love changes :-)

1. Can we create graphical element (I mean to implement class inherit
from Window class VCL module) so this element can float on top of its
parent. What methods we should override and how add it so it can
receive mouse events?
        Ah - so Window is misleading, that is a very low base class. You want
to inherit from eg. Dialog, or SystemWindow I suspect.

2. In the SwEditWin class we have override Paint() function in which
we want to draw a background.
        Oooh - fun :-)

  The ViewShell class has _PaintDesktop() function where background
draw partly. If we comment _PaintDesktop function to prevent
background drawing  we'll receive white background. And if we draw
something in SwEditWin::Paint() we have the same white background. If
we comment in SwEditWin::Paint() line pWrtShell->Paint(...) background
will not paint in white. So we can't understand where occurs white
paint. What do you think?
        Well; you sure it is white ? I had a hack at this in the past - I
attach my nasty patch to writer to make shockingly ugly looking
gradients in the background ;-) hopefully it shows you where to hack.
Having said that I think some of that code needs cleaning up really :-)

        ATB,

                Michael.



--
С Уважением,
Дмитрий

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 72dcebc..7285071 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1486,6 +1486,8 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
         _PaintDesktop( aRegion );
 }
 
+#include <vcl/gradient.hxx>
+
 void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
 {
     GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
@@ -1526,9 +1528,14 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
 
         // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
         // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
+#ifdef BORING
         GetOut()->SetFillColor( SwViewOption::GetAppBackgroundColor());
         GetOut()->SetLineColor();
         GetOut()->DrawRect(aRectangle);
+#else // fun
+        Gradient g(GRADIENT_LINEAR, Color(COL_RED), Color(COL_BLUE));
+        GetOut()->DrawGradient(aRectangle, g);
+#endif
 
         DLPostPaint2(false);
     }
--- Begin Message ---
Hi guys,

On Sat, 2011-01-08 at 22:20 +0100, Christoph Noack wrote:
Am Samstag, den 08.01.2011, 02:05 +0100 schrieb Bernhard Dippold:
I was thinking of a nice background instead of a static colour.
You can find some of my design here
http://rahulprasad.com/public/libreOffice/writer/
..
"That's one small step for developer, one giant leap for LibreOffice."

        Well - it is a few lines of code for sure. I attach the awful hack to
give a weirdo gradient as the background instead of grey; picture here
http://users.freedesktop.org/~michael/gradient.png - most likeyl I can't
sepell either ;-)

        Anyhow - the patch is clearly too simple - we need to get offsets right
for re-painting sub-regions.

The very first step is, indeed, to know how much effort it required to
show graphics (whatever kind) on / instead of the application
background.

        It is really rather easy I think. The complexity is mostly around good
taste [ which often vanishes at this point ], and about the
interactions.

        Eg. having a forest scene is all well and good - relaxing etc. but it
could (potentially) break the desktop metaphore - at least, as I see a
viewport scroll, I don't think of it sliding pages over a document, I
think of myself as moving down the document ;-) [ perhaps this is just
me ]. The problem with my view though, is - where do we get more image
from to back a 1000 page document ? ie. I don't think photos work here,
unless they are static, which would prolly look odd.

        Other problems:

        * we can of course only do this for 'writer' and
          'draw/impress' I guess; we should do both, not just one.

        * this may give us some very real performance hit when
          scrolling on older hardware [ or perhaps not - hard to
          know ] - currently we pull out a lot of stops to try to
          get smooth scrolling; this could vandalise all that quite
          easily.

        Of course; making the page surround / backdrop somewhat more pleasant
to look at and sexy is not impossibly difficult either; but gradients
are effectively images: they cost CPU. Probably we need to reconcile
ourselves to this sometime (like right now), but having a team of people
enthusiastic to fight off the "it doesn't work on my 486 with Trident
graphics anymore" chappies would be appreciated.

In context, it is on "our" proposal collection page for the StartCenter:
http://wiki.services.openoffice.org/wiki/User_Experience/StartCenter#Mockups

        I guess the start center is another target, with (no doubt) a different
code path again.

Ouch! Some time before (2007?), I have been told that changing anything
which is beyond the document border is pretty hard. I would be more than
happy if anything can prove this to be wrong ;-)

        ;-)

This (for example) is the reason for not having shadows on the right
side for the Writer comments/notes (instead, we live with 80's style
shadow for the pages).

        Really ? we should have an easy hack to improve that too I suppose. I
was going to add a number today from the UI suggestions, but didn't get
there - sorry ...

        Hmm,

                Michael.

-- 
 michael.meeks@novell.com  <><, Pseudo Engineer, itinerant idiot

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 72dcebc..7285071 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1486,6 +1486,8 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
         _PaintDesktop( aRegion );
 }
 
+#include <vcl/gradient.hxx>
+
 void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
 {
     GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
@@ -1526,9 +1528,14 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
 
         // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
         // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
+#ifdef BORING
         GetOut()->SetFillColor( SwViewOption::GetAppBackgroundColor());
         GetOut()->SetLineColor();
         GetOut()->DrawRect(aRectangle);
+#else // fun
+        Gradient g(GRADIENT_LINEAR, Color(COL_RED), Color(COL_BLUE));
+        GetOut()->DrawGradient(aRectangle, g);
+#endif
 
         DLPostPaint2(false);
     }

--- End Message ---

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.