您在哪里以及如何称呼重新分页和重新绘制? [英] Where and how do you call repaginate and redraw?

查看:55
本文介绍了您在哪里以及如何称呼重新分页和重新绘制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们再试一次.重新对事物进行分页以更改文档的最佳方法是什么?

我想知道的是你们所有人所说的重新分页.我得出的结论是,您在事务类中具有做,撤消,重做等功能,这就是您所说的重新分页.这对每个人来说都看似正常吗?还是有更好的方法呢?

如果确实是这样做的话,我正在考虑使用侦听器模式".有人可以对此发表评论吗?也许最好是在用户插入或撤消某些操作时,在每笔交易中都调用repaginate和重绘.感谢您的体会.

Let''s try this one again. What is the best way to repaginate things for a change to a document?

What I would like to know is where all of you people call repaginate. I came to the conclusion that you have do, undo, redo, etc., functions in your transaction class and that''s where you would call re-paginate. Does this seem par for the course (normal) to everyone or is there a better way to do it?

If this is indeed the way to do it, I was considering using the "listener pattern". Can anyone comment on this? Maybe it''s best just to call repaginate and redraw in each and every transaction when the user inserts or undoes something. I appreciate your experience.

推荐答案

我不确定在这种情况下重新翻页和重画的意思...

如果您的文档是基于交易的,那么当交易完成时,您将执行以下操作:

I''m not sure what you mean by repaginate and redraw in this context...

If your document is transaction based then when a transaction is completed you''d do something like:

transaction::complete()
{
    doc_->SetModifiedFlag();
    doc_->UpdateAllViews();
};



这样交易的最后一件事就是确保保存了要操作的文档(或者作者询问他或她是否要保存文档)并更新了视图.

您无需在代码中实现类似OBSERVER的功能,该框架已经为您完成了大部分工作.诚然,UpdateAllViews是一种非常紧密地耦合在一起的方式,但是它像大多数Microsoft MFC辅助程序一样,是没有人真正知道如何在1992年编写C ++的产物.

干杯,



so that the last thing the transaction does is make sure the document operated on is saved (or the author asked if he or she wants to save it) and the view is updated.

There''s no need for you to implement something like OBSERVER in your code, the framework already does most of that for you. Admittedly UpdateAllViews is a very tightly coupled way of doing this but it''s there and, like most Microsoft MFC faux pas it''s a product of no one really knowing how to write C++ back in 1992.

Cheers,

Ash


这篇关于您在哪里以及如何称呼重新分页和重新绘制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆