[Cin] How to add correctly BC_TumbleTextBox ?

Andrew Randrianasulu randrianasulu at gmail.com
Mon Mar 16 17:43:35 CET 2020


В сообщении от Monday 16 March 2020 19:01:27 Phyllis Smith написал(а):
> Turns out there are widgets and gadgets (old school parlance).  Widgets
> usually involve a window base class, and gadgets usually involve a set of
> widgets or gadgets.  A BC_TumbleTextBox is a gadget, which has a textbox
> widget and a tumbler widget.  The "create_objects()" call is mandatory for
> gadgets. A gadget tries to create an organized set of widgets as a
> graphical component.   It may have a window base class, and may need an
> add_subwindow... or (as with most of them) it may just be a group of
> objects, usually with a common x,y,w,h base class definition.  For a
> BC_TumbleTextBox, just call create objects, and do not add_subwindow.   The
> exact initialization order determines this, and can be variable.  For
> instance, a popup menu, or a list box may need add_window, and also a
> create_objects to load the widget content prior to invoking the draw.
> 
> It is frequently attractive (from a programming perspective) to add a
> pointer to the widgets and gadgets in the gui base class so that you can
> easily access them from the debugger.  add_subwindow adds the subwindow to
> the gui subwindow list, and makes it part of the window hierarchy.
> Anything created and added with add_subwindow should probably not be
> deleted in the destructor.  The destruction of the gui will delete it
> normally.   You can delete a subwindow (lock the gui), and it is ok to do
> that if your intent to to re-factor the gui appearance after construction.
> Gadgets usually need to be deleted in the gui destructor since the object
> is not in the gui subwindow set.  If you dont delete it, it wont cause an
> error, but it will be a memory leak.
> 
> I tweaked/attached the patch for your review.  It is not tested,
> gg

Thanks, I manually added it to source tree, with minor mod:

@@ -351,21 +351,30 @@ PNGUnit::~PNGUnit()
 PNGConfigVideo::PNGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
  : BC_Window(_(PROGRAM_NAME ": Video Compression"),
 	parent_window->get_abs_cursor_x(1), parent_window->get_abs_cursor_y(1),
-	xS(200), yS(100))
+	xS(200), yS(120))
 {
 	this->parent_window = parent_window;
 	this->asset = asset;
+	use_alpha = 0;
+	compression = 0;
 }

replaced alpha with use_alpha, otherwise it was not compileable.

But now just compiled cin fails to start from its bin directory!

LANG=C ./cin
Cinelerra Infinity - built: Mar 16 2020 01:05:34
git://git.cinelerra-gg.org/goodguy/cinelerra.git
(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
Cinelerra is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. There is absolutely no warranty for Cinelerra.

cin: malloc.c:2395: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Аварийный останов

system-installed cin still works normally ...

> 
> On Mon, Mar 16, 2020 at 5:29 AM Andrew Randrianasulu <
> randrianasulu at gmail.com> wrote:
> 
> > I tried to add png compression level into filepng.c
> >
> > But I did something stupid, and whole thing doesn't compile:
> >
> > root at slax:/dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra#
> > LANG=C make
> > g++ `cat i686/c_flags`  -DMSGQUAL=filepng -c filepng.C -o i686/filepng.o
> > filepng.C: In member function 'virtual void
> > PNGConfigVideo::create_objects()':
> > filepng.C:370:49: error: no matching function for call to
> > 'PNGConfigVideo::add_subwindow(PNGCompression*)'
> >   add_subwindow(new PNGCompression(this, x+50, y));
> >                                                  ^
> > In file included from
> > /dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra/../guicast/bcsubwindow.h:26:0,
> >                  from
> > /dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra/../guicast/bcbar.h:26,
> >                  from
> > /dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra/../guicast/guicast.h:27,
> >                  from edit.h:30,
> >                  from filepng.C:23:
> > /dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra/../guicast/bcwindowbase.h:276:17:
> > note: candidate: BC_WindowBase* BC_WindowBase::add_subwindow(BC_WindowBase*)
> >   BC_WindowBase* add_subwindow(BC_WindowBase *subwindow);
> >                  ^
> > /dev/shm/tmp/cinelerra-goodguy-20200316/cinelerra-5.1/cinelerra/../guicast/bcwindowbase.h:276:17:
> > note:   no known conversion for argument 1 from 'PNGCompression*' to
> > 'BC_WindowBase*'
> > At global scope:
> > cc1plus: warning: unrecognized command line option
> > '-Wno-stringop-truncation'
> > cc1plus: warning: unrecognized command line option '-Wno-format-overflow'
> > cc1plus: warning: unrecognized command line option '-Wno-format-truncation'
> > cc1plus: warning: unrecognized command line option '-Wno-stringop-overflow'
> > cc1plus: warning: unrecognized command line option
> > '-Wno-unknown-warning-option'
> > make: *** [i686/filepng.o] Error 1
> >
> > patch attached ....
> > --
> > Cin mailing list
> > Cin at lists.cinelerra-gg.org
> > https://lists.cinelerra-gg.org/mailman/listinfo/cin
> >
> 




More information about the Cin mailing list