From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Suggestions about UiKit for Emacs Date: Wed, 26 Sep 2018 21:52:55 -0400 Message-ID: <87a3e21a-4ffa-4460-a45c-5f01c832f9d4@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1538013095 5478 195.159.176.226 (27 Sep 2018 01:51:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2018 01:51:35 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 27 03:51:31 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5LSk-0001K5-Fz for ged-emacs-devel@m.gmane.org; Thu, 27 Sep 2018 03:51:30 +0200 Original-Received: from localhost ([::1]:33341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5LUr-0002Lz-2Z for ged-emacs-devel@m.gmane.org; Wed, 26 Sep 2018 21:53:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5LUB-0002Lu-JO for emacs-devel@gnu.org; Wed, 26 Sep 2018 21:53:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5LUA-00024l-Oh for emacs-devel@gnu.org; Wed, 26 Sep 2018 21:52:59 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:36581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5LUA-00024b-Jw for emacs-devel@gnu.org; Wed, 26 Sep 2018 21:52:58 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id a85-v6so654865qkg.3 for ; Wed, 26 Sep 2018 18:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=8xkm5KOg6cdiDxqrQ+zUIkQaEIAa5OWVLFSr3MvDe6c=; b=Yv5yN4CCLSSB/qeDrqIwggMd14O/4o5UEWcFKmV/Ji/G7rrsD0eOHFImz2bCgUKUE+ HY7OL1STksmryVRNS6Yct0wsA2r8Vjegfi2O9bThm5p/dw0FYS+NLNsYeSjtDhRt6fTL o3TroOZBfGIn2lW0MXs9ZUVJDZsQ2HiY6PdOs1wtR46rBfR70o+tzgoP2YDnitV2kCRC W0gZvVvhTw1RwiJOwoPpYrDr9mNRt+DWYR2Moh3IZdecerFIa9pYQ1YQ6A616Gb0/nme nZvB0Q5qtIMeHAVJI0iGlUURfmwVNysNEWB1RN0+ppW8EpFdFCx21nytkE4VPCI3kOtA DQPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=8xkm5KOg6cdiDxqrQ+zUIkQaEIAa5OWVLFSr3MvDe6c=; b=bmTZnpRrkPw4bAk9I4RZm7MO5hSyRRfQbXeVqMMvHd++NcTmnef2gJjpvStnvWHeIy /TQBG+ZeN+xaJJvFQoNmATw+QydgYuqNcS3BZATccxYkulNRf8vej7G57X3AqJtXue4u AoKf4vIfUJni/la2vKwVFQ0s6lwDqdl6HeYi2YnRRqfvWZGerH1wVAQzs68HV7kXrb5H GxPqbK+HBgVyc181OMaj3rqdjLn5BuECauj673m/JxBkpZhZl6u3kj/z27x9SXJAFlG3 Ss9UCM8UjNKLRNHmsS5ejtljuSPb24ho5mcyYaUXotv8KTyyiqArvzNYWC5lglfOR6dS S97w== X-Gm-Message-State: ABuFfojhzIP8afd52zHmRPzCom3E9Iem80zdYC19hPuR56xiSMEFqhXr 42d/IcG8prXcux2Grd8rsF9/wB62 X-Google-Smtp-Source: ACcGV61sbvxlgSznBNasnSsuP5vHZgXp2sA9l2aDybL8jTWp+HwUWKuf4Eyh+rgTi5Ru4RnfTfqZyg== X-Received: by 2002:a37:6e01:: with SMTP id j1-v6mr6426863qkc.70.1538013177360; Wed, 26 Sep 2018 18:52:57 -0700 (PDT) Original-Received: from ?IPv6:2601:4b:67f:ef48:6df5:d1dc:95e0:c76c? ([2601:4b:67f:ef48:6df5:d1dc:95e0:c76c]) by smtp.gmail.com with ESMTPSA id a13-v6sm498259qkg.94.2018.09.26.18.52.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 18:52:56 -0700 (PDT) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::732 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230093 Archived-At: Hi everyone, I'm trying to make this text-based GUI framework for Emacs. I am aware of Widget, but it is half done to me, lacking some important features like auto layout. Basically this framework frees developers from fiddling with markers, text properties and inserting and deleting texts. It provides a abstraction just like other GUI frameworks, like cocoa. With this framework, a Emacs hacker can put up a little convenient user interface for his/her package easily. With this framework, developers are able to create scenes, and adds views to them, views can be buttons, switches, labels, tables and other UI element. The views are organized by grouping into stacks. Actually the scene is the top level stack. Message passing is mostly done by symbols, so one can create a button by (uikit-make-view 'button 'button-name) and define the function to be called by (defun uikit-button-name-pressed () ()). The problem I'm having now is the auto layout part. The version I have designed right now seems a bit complicated: So when a scene draws itself on a buffer, it recursively asks its sub-views to draw. And for a stack or view to draw, they need a position, that's when auto layout comes in to the play. Currently I have these rules for a stack to arrange its sub-views: equal-spacing, by-portion and stacking. Equal spacing basically means the stack puts equal space between its sub-views to fill the stack.So the stack size is defined before auto layout, either set by its parent stack or set in the code by the developer. By portion means the developer specifies how much portion of the stack does each sub-view takes. So the stack size is defined before auto layout, either set by its parent stack or set in the code by the developer. Stacking means the stack "stacks" each sub-view one after another, so the stack size is depended on its sub-views. I'm worried that the rule getting too complicated, as you can see, some stack rules require to know sub-view's size before it knows its own size, some stack rules are the opposite: the stack's size has to be know before auto layout. Could you give me more suggestions about auto layout? Please ask any further questions if I'm not clear. And I'm appreciated to any suggestions about the design and implementation of the framework. I've put my code to gist since it's a bit long for an email. You can find it at https://gist.github.com/casouri/1bc2e29fa9679d2c9ed705a324bfd30d Thanks. Yuan Fu